Ejemplo n.º 1
0
 def test_that_start_and_end_more_than_24_hours_gives_http_400_json(self):
     expected = {
         'detail': '`start` and `end` must be no greater than 24 '
         'hours apart'
     }
     path = PATH + '?start=2014-01-01T00:00:00Z&end=2014-01-02T00:01:00Z'
     assert_json_response(self.client.get(path), 400, expected)
 def test_that_start_and_end_exactly_24_hours_is_ok_http_200(self):
     path = PATH + '?start=2014-06-10T00:00:00Z&end=2014-06-11T00:00:00Z'
     expected = {'raw_measurements': [
         {'datetime': '2014-06-10T10:00:00Z', 'height': 1.23},
         {'datetime': '2014-06-10T10:30:00Z', 'height': 1.56},
     ]}
     assert_json_response(self.client.get(path), 200, expected)
Ejemplo n.º 3
0
    def test_that_missing_end_parameter_has_json_400_error(self):
        expected = {
            'detail': 'Missing parameter `end`. '
            'Format: 2014-11-30T00:00:00Z'
        }

        path = PATH + '?start=2014-01-02T00:00:00'
        assert_json_response(self.client.get(path), 400, expected)
Ejemplo n.º 4
0
 def test_that_start_and_end_exactly_24_hours_is_ok_http_200(self):
     path = PATH + '?start=2014-06-10T00:00:00Z&end=2014-06-11T00:00:00Z'
     expected = {
         'raw_measurements': [
             {
                 'datetime': '2014-06-10T10:00:00Z',
                 'height': 1.23
             },
             {
                 'datetime': '2014-06-10T10:30:00Z',
                 'height': 1.56
             },
         ]
     }
     assert_json_response(self.client.get(path), 200, expected)
Ejemplo n.º 5
0
 def test_that_a_non_existent_gauge_gives_an_http_404_with_json(self):
     expected = {'detail': 'Tide gauge not found: `no-such-gauge`.'}
     assert_json_response(self.client.get(BASE_PATH + 'no-such-gauge/'),
                          404, expected)
Ejemplo n.º 6
0
 def test_that_no_gauge_in_url_gives_an_http_404_with_json(self):
     expected = {'detail': 'No tide gauge specified in URL.'}
     assert_json_response(self.client.get(BASE_PATH), 404, expected)
 def test_that_a_non_existent_gauge_gives_an_http_404_with_json(self):
     expected = {'detail': 'Tide gauge not found: `no-such-gauge`.'}
     assert_json_response(
         self.client.get(BASE_PATH + 'no-such-gauge/'), 404, expected)
 def test_that_no_gauge_in_url_gives_an_http_404_with_json(self):
     expected = {'detail': 'No tide gauge specified in URL.'}
     assert_json_response(
         self.client.get(BASE_PATH), 404, expected)
    def test_that_missing_end_parameter_has_json_400_error(self):
        expected = {'detail': 'Missing parameter `end`. '
                              'Format: 2014-11-30T00:00:00Z'}

        path = PATH + '?start=2014-01-02T00:00:00'
        assert_json_response(self.client.get(path), 400, expected)
 def test_that_start_and_end_more_than_24_hours_gives_http_400_json(self):
     expected = {'detail': '`start` and `end` must be no greater than 24 '
                           'hours apart'}
     path = PATH + '?start=2014-01-01T00:00:00Z&end=2014-01-02T00:01:00Z'
     assert_json_response(self.client.get(path), 400, expected)