aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test_config.yaml2
-rw-r--r--tests/test_app.py17
-rw-r--r--tests/test_config.py2
3 files changed, 17 insertions, 4 deletions
diff --git a/tests/data/test_config.yaml b/tests/data/test_config.yaml
index fa44e32..4a485ff 100644
--- a/tests/data/test_config.yaml
+++ b/tests/data/test_config.yaml
@@ -1 +1 @@
-backend: none
+backend: memory
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)
diff --git a/tests/test_config.py b/tests/test_config.py
index 7851019..6002dd9 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -19,4 +19,4 @@ class TestConfig(unittest.TestCase):
'tests/data/test_config.yaml'
)
self.assertIn('backend', self.config.data)
- self.assertEqual(self.config.backend, 'none')
+ self.assertEqual(self.config.backend, 'memory')