Ejemplo n.º 1
0
 def test_cors_requests_can_cache_control(self):
     response = self.app.open('/data/some-group/some-type',
                              method='OPTIONS')
     assert_that(
         response,
         has_header('Access-Control-Allow-Headers',
                    'cache-control, govuk-request-id, request-id'))
Ejemplo n.º 2
0
    def test_allow_origin_set_on_500(self, mock_query):
        mock_query.side_effect = StandardError('fail!')
        response = self.app.get('/foo')

        assert_that(response, has_status(500))
        assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
Ejemplo n.º 3
0
 def test_allow_origin_set_on_404(self):
     response = self.app.get('/data_set')
     assert_that(response, has_status(404))
     assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
Ejemplo n.º 4
0
 def test_cors_preflight_are_allowed_from_all_origins(self):
     response = self.app.open('/data_set', method='OPTIONS')
     assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
Ejemplo n.º 5
0
    def test_allow_origin_set_on_500(self, mock_query):
        mock_query.side_effect = StandardError('fail!')
        response = self.app.get('/foo')

        assert_that(response, has_status(500))
        assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
Ejemplo n.º 6
0
 def test_allow_origin_set_on_404(self):
     response = self.app.get('/data_set')
     assert_that(response, has_status(404))
     assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
Ejemplo n.º 7
0
 def test_cors_preflight_are_allowed_from_all_origins(self):
     response = self.app.open('/data_set', method='OPTIONS')
     assert_that(response, has_header('Access-Control-Allow-Origin', '*'))
 def test_cache_control_is_set_to_no_cache_for_unpublished_data_sets(self):
     response = self.app.get('/data/some-group/some-type')
     assert_that(response, has_header('Cache-Control', 'no-cache'))
    def test_max_age_is_2_min_for_realtime_data_sets(self):
        response = self.app.get('/data/some-group/some-type')

        assert_that(
            response, has_header('Cache-Control', 'max-age=120, must-revalidate'))
 def test_cors_requests_can_cache_control(self):
     response = self.app.open(
         '/data/some-group/some-type', method='OPTIONS')
     assert_that(response, has_header('Access-Control-Allow-Headers',
                                      'cache-control, govuk-request-id, request-id'))
 def test_cors_preflight_result_cache(self):
     response = self.app.open(
         '/data/some-group/some-type', method='OPTIONS')
     assert_that(response, has_header('Access-Control-Max-Age', '86400'))
    def test_max_age_is_30_min_for_non_realtime_buckets(self):
        response = self.app.get('/data/some-group/some-type?period=week')

        assert_that(response, has_header('Cache-Control', 'max-age=1800, must-revalidate'))
Ejemplo n.º 13
0
 def test_cache_control_is_set_to_no_cache_for_unpublished_data_sets(self):
     response = self.app.get('/data/some-group/some-type')
     assert_that(response, has_header('Cache-Control', 'no-cache'))
Ejemplo n.º 14
0
    def test_max_age_is_2_min_for_realtime_data_sets(self):
        response = self.app.get('/data/some-group/some-type')

        assert_that(
            response,
            has_header('Cache-Control', 'max-age=120, must-revalidate'))
Ejemplo n.º 15
0
 def test_cors_preflight_result_cache(self):
     response = self.app.open('/data/some-group/some-type',
                              method='OPTIONS')
     assert_that(response, has_header('Access-Control-Max-Age', '86400'))