def test_add(self): from models import Image Image.add(name="Hallo.img") img = Image.by_id(1) self.assertEqual(1, img.id) self.assertEqual("Hallo.img", img.name) self.assertEqual("hallo.img", img.route)
def view(self): request = self.request id = request.matchdict['id'] image = Image.by_id(id) if image is None: return HTTPNotFound("No such image") return dict( image=image, pages=Page.all(), logged_in=authenticated_userid(self.request), )