def test_404s(self):
        app = create_app('ndopapp.config.Config')
        client = app.test_client()
        result = client.get('/missingpage')

        self.assertEqual(result.status_code, HTTPStatus.NOT_FOUND)
        self.assertEqual(result.data, b"Page Not Found")
Exemple #2
0
    def setUp(self):
        app = create_app('ndopapp.config.TestConfig')
        self.client = app.test_client()
        self.client.set_cookie("test", common.SESSION_COOKIE_KEY, common.SESSION_ID)
        self.app = app

        self.app_patcher = patch('ndopapp.yourdetails.controllers.app')
        self.app_mock = self.app_patcher.start()
        self.addCleanup(self.app_patcher.stop)
Exemple #3
0
    def test_handle_requests_when_an_exception_is_raised(self, name_form_mock, redirect_mock, log_safe_exception_mock):
            
        app = create_app('ndopapp.config.Config')
        # force raising exception on a controller logic
        test_exception = Exception('message')
        name_form_mock.side_effect = test_exception

        client = app.test_client()
        result = client.get(routes.get_absolute("yourdetails.your_details"))

        log_safe_exception_mock.assert_called_with(test_exception)
        redirect_mock.assert_called_with("main.generic_error")
Exemple #4
0
 def setUp(self):
     app = create_app('ndopapp.config.TestConfig')
     self.client = app.test_client()
     self.app = app
Exemple #5
0
 def setUp(self):
     self.app = create_app('ndopapp.config.TestConfig')
#!/usr/bin/env python3

from ndopapp import create_app

app = create_app("ndopapp.config.Config")

if __name__ == '__main__':
    app.run()
Exemple #7
0
 def setUp(self):
     app = create_app('ndopapp.config.TestConfig')
     self.client = app.test_client()
     self.client.set_cookie("test", common.SESSION_COOKIE_KEY,
                            common.SESSION_ID)
     self.app = app
 def setUp(self):
     self.app = create_app('ndopapp.config.TestConfig')
     common.registerExceptionHandlers(self.app)
 def setUp(self):
     app = create_app('ndopapp.config.TestConfig')
     self.client = app.test_client()
     self.postcode_validator = PostcodeValidator()
 def setUp(self):
     app = create_app('ndopapp.config.TestConfig')
     self.client = app.test_client()
     self.number_length_validator = NumberLengthValidator()