示例#1
0
    def test_passing_view(self):
        from cyberrange.models.models import (
            Base,
            MyModel,
            )
        Base.metadata.create_all(self.engine)
        with transaction.manager:
            model = MyModel(name='one', value=55)
            DBSession.add(model)

        from cyberrange.views.views import my_view
        request = testing.DummyRequest()
        info = my_view(request)
        self.assertEqual(info['one'].name, 'one')
        self.assertEqual(info['project'], 'CyberRange')
示例#2
0
 def test_failing_view(self):
     from cyberrange.views.views import my_view
     request = testing.DummyRequest()
     info = my_view(request)
     self.assertEqual(info.status_int, 500)