Esempio n. 1
0
 def test_default_root_is_symlink_raises_error(self):
     os.symlink('/', '/tmp/foo')
     try:
         with self.assertRaises(ValueError):
             app = taunus.main({}, default_root='/tmp/foo')
     finally:
         os.remove('/tmp/foo')
Esempio n. 2
0
 def setUp(self):
     self.test_dir = tempfile.mkdtemp()
     app = taunus.main({}, default_root=self.test_dir)
     self.app = TestApp(app)
Esempio n. 3
0
 def test_vanished_default_root_raises_error(self):
     test_dir = tempfile.mkdtemp()
     app = TestApp(taunus.main({}, default_root=test_dir))
     shutil.rmtree(test_dir)
     with self.assertRaises(ValueError):
         app.get('/')
Esempio n. 4
0
 def test_default_root_not_absolute_raises_error(self):
     with self.assertRaises(ValueError):
         app = taunus.main({}, default_root='~')
Esempio n. 5
0
 def test_init_with_unexistent_default_root_raises_error(self):
     with self.assertRaises(ValueError):
         app = taunus.main({}, default_root='/non/existing/path/')
Esempio n. 6
0
 def test_missing_default_root_raises_error(self):
     with self.assertRaises(KeyError):
         app = taunus.main({})