aboutsummaryrefslogtreecommitdiff
path: root/tests/test_views.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-10-29 14:54:38 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2017-10-29 14:54:38 +0100
commit7163dfa3d0252067de90e8c088ea90d0b0f7d059 (patch)
tree11fa27982ff2c328435a128df3a8ab44b25593f7 /tests/test_views.py
parenta5fbd781ccc9b64483cc499c375fa6e0e99ade1d (diff)
Load a collection from command line and show a list of items
Diffstat (limited to 'tests/test_views.py')
-rw-r--r--tests/test_views.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/test_views.py b/tests/test_views.py
index 9c0c471..efb87bf 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -1,11 +1,12 @@
-import cherrypy
+from lesana import Collection
+import cherrypy
from cherrypy.test import helper
from cherry_lesana import App
-class TestViews(helper.CPWebCase):
+class TestNoCollection(helper.CPWebCase):
def setup_server():
cherrypy.tree.mount(App())
setup_server = staticmethod(setup_server)
@@ -13,3 +14,23 @@ class TestViews(helper.CPWebCase):
def test_root(self):
self.getPage('/')
self.assertStatus(200)
+
+ def test_list(self):
+ self.getPage('/list')
+ self.assertStatus(200)
+ self.assertInBody('No collection loaded')
+
+
+class TestSimpleCollection(helper.CPWebCase):
+ def setup_server():
+ collection = Collection('tests/data/simple')
+ collection.update_cache()
+ cherrypy.tree.mount(App(Collection('tests/data/simple')))
+ setup_server = staticmethod(setup_server)
+
+ def test_list(self):
+ self.getPage('/list')
+ self.assertStatus(200)
+ self.assertNotInBody('No collection loaded')
+ self.assertInBody('Simple lesana collection')
+ self.assertInBody('Another item')