Show More
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 |
@@ -0,0 +1,32 b'' | |||||
|
1 | """Test the /tree handlers""" | |||
|
2 | import os | |||
|
3 | import io | |||
|
4 | from IPython.html.utils import url_path_join | |||
|
5 | from IPython.nbformat import write | |||
|
6 | from IPython.nbformat.v4 import new_notebook | |||
|
7 | ||||
|
8 | import requests | |||
|
9 | ||||
|
10 | from IPython.html.tests.launchnotebook import NotebookTestBase | |||
|
11 | ||||
|
12 | class TreeTest(NotebookTestBase): | |||
|
13 | def setUp(self): | |||
|
14 | nbdir = self.notebook_dir.name | |||
|
15 | d = os.path.join(nbdir, 'foo') | |||
|
16 | os.mkdir(d) | |||
|
17 | ||||
|
18 | with io.open(os.path.join(d, 'bar.ipynb'), 'w', encoding='utf-8') as f: | |||
|
19 | nb = new_notebook() | |||
|
20 | write(nb, f, version=4) | |||
|
21 | ||||
|
22 | with io.open(os.path.join(d, 'baz.txt'), 'w', encoding='utf-8') as f: | |||
|
23 | f.write(u'flamingo') | |||
|
24 | ||||
|
25 | self.base_url() | |||
|
26 | ||||
|
27 | def test_redirect(self): | |||
|
28 | r = requests.get(url_path_join(self.base_url(), 'tree/foo/bar.ipynb')) | |||
|
29 | self.assertEqual(r.url, self.base_url() + 'notebooks/foo/bar.ipynb') | |||
|
30 | ||||
|
31 | r = requests.get(url_path_join(self.base_url(), 'tree/foo/baz.txt')) | |||
|
32 | self.assertEqual(r.url, url_path_join(self.base_url(), 'files/foo/baz.txt')) |
General Comments 0
You need to be logged in to leave comments.
Login now