def test_my_view_success(app_request, dbsession): model = models.MyModel(name='one', value=55) dbsession.add(model) dbsession.flush() info = my_view(app_request) assert app_request.response.status_int == 200 assert info['one'].name == 'one' assert info['project'] == 'sqla_demo'
def test_my_view_failure(app_request): info = my_view(app_request) assert info.status_int == 500
def test_failing_view(self): from sqla_demo.views.default import my_view info = my_view(dummy_request(self.session)) self.assertEqual(info.status_int, 500)
def test_passing_view(self): from sqla_demo.views.default import my_view info = my_view(dummy_request(self.session)) self.assertEqual(info['one'].name, 'one') self.assertEqual(info['project'], 'sqla_demo')