diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-04-22 18:02:51 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-04-22 18:02:51 +0200 |
commit | decd9a8b86410386783df7c9faa8b4d90febe09b (patch) | |
tree | cabb8070ffca1c8fa6aa6b11bf7b733fb1492872 /tests/test_app.py | |
parent | 94baa0b3c43954204dd6c2049b36fb7523e6c844 (diff) |
Retrieve objects from an URL
Diffstat (limited to 'tests/test_app.py')
-rw-r--r-- | tests/test_app.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_app.py b/tests/test_app.py index 1ff504c..f78149b 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,12 +1,25 @@ from tornado.testing import AsyncHTTPTestCase -from pyapd import app, config +from pyapd import app, config, objects class TestApp(AsyncHTTPTestCase): def get_app(self, *args, **kw): - return app.App(config.Config('tests/data/test_config.yaml')) + if not getattr(self, 'app', None): + self.app = app.App(config.Config('tests/data/test_config.yaml')) + return self.app def test_root(self): res = self.fetch('/') self.assertEqual(res.code, 200) + + def test_object_view(self): + oid = self.get_url('/object/12345') + obj = objects.Object(id=oid) + self.app.store.add(obj) + res = self.fetch('/object/12345') + self.assertEqual(res.code, 200) + + def test_object_view_non_existing(self): + res = self.fetch('/object/does_not_exist') + self.assertEqual(res.code, 404) |