from lesana import Collection import cherrypy from cherrypy.test import helper from cherry_lesana import App class TestNoCollection(helper.CPWebCase): def setup_server(): cherrypy.tree.mount(App()) setup_server = staticmethod(setup_server) 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')