##// END OF EJS Templates
Add some unit tests for the new dictionary syntax for installing nbextensions
Jason Grout -
Show More
@@ -133,6 +133,8 b' class TestInstallNBExtension(TestCase):'
133 d = u'∂ir'
133 d = u'∂ir'
134 install_nbextension(pjoin(self.src, d))
134 install_nbextension(pjoin(self.src, d))
135 self.assert_installed(self.files[-1])
135 self.assert_installed(self.files[-1])
136 install_nbextension({'test': pjoin(self.src, d)})
137 self.assert_installed(pjoin('test', u'∂ir2', u'ƒile2'))
136
138
137 def test_install_nbextension(self):
139 def test_install_nbextension(self):
138 install_nbextension(glob.glob(pjoin(self.src, '*')))
140 install_nbextension(glob.glob(pjoin(self.src, '*')))
@@ -240,6 +242,8 b' class TestInstallNBExtension(TestCase):'
240 self.assert_installed("foo.js")
242 self.assert_installed("foo.js")
241 install_nbextension("https://example.com/path/to/another/bar.js")
243 install_nbextension("https://example.com/path/to/another/bar.js")
242 self.assert_installed("bar.js")
244 self.assert_installed("bar.js")
245 install_nbextension({'foobar.js': "https://example.com/path/to/another/bar.js"})
246 self.assert_installed("foobar.js")
243 finally:
247 finally:
244 nbextensions.urlretrieve = save_urlretrieve
248 nbextensions.urlretrieve = save_urlretrieve
245
249
@@ -250,10 +254,9 b' class TestInstallNBExtension(TestCase):'
250 touch(src)
254 touch(src)
251 install_nbextension(src, user=True)
255 install_nbextension(src, user=True)
252
256
253 nbext = pjoin(self.ipdir, u'nbextensions')
257 assert check_nbextension(f, user=True)
254 assert check_nbextension(f, nbext)
258 assert check_nbextension([f], user=True)
255 assert check_nbextension([f], nbext)
259 assert not check_nbextension([f, pjoin('dne', f)], user=True)
256 assert not check_nbextension([f, pjoin('dne', f)], nbext)
257
260
258 @dec.skip_win32
261 @dec.skip_win32
259 def test_install_symlink(self):
262 def test_install_symlink(self):
@@ -280,3 +283,11 b' class TestInstallNBExtension(TestCase):'
280 with self.assertRaises(ValueError):
283 with self.assertRaises(ValueError):
281 install_nbextension(zsrc, symlink=True)
284 install_nbextension(zsrc, symlink=True)
282
285
286 def test_install_different_name(self):
287 with TemporaryDirectory() as d:
288 f = u'ƒ.js'
289 src = pjoin(d, f)
290 dest_f = 'ƒile.js'
291 touch(src)
292 install_nbextension({dest_f: src})
293 self.assert_installed(dest_f)
General Comments 0
You need to be logged in to leave comments. Login now