def test_that_querying_for_less_than_7_days_periods_is_disabled(self): response = self.app.get("/pub?" "group_by=guiness" "&start_at=2012-01-01T00:00:00Z" "&end_at=2012-01-07T23:59:30Z") assert_that(response, is_bad_request())
def test_request_must_be_json(self): response = self.app.post( '/foo', data='foobar', headers=[('Authorization', 'Bearer foo-bearer-token')], ) assert_that( response, is_bad_request()) assert_that( response, is_error_response())
def test_that_querying_for_less_than_7_days_periods_is_disabled(self): response = self.app.get( "/pub?" "group_by=guiness" "&start_at=2012-01-01T00:00:00Z" "&end_at=2012-01-07T23:59:30Z" ) assert_that(response, is_bad_request())
def test_request_must_be_json(self): response = self.app.post( '/foo', data='foobar', headers=[('Authorization', 'Bearer foo-bearer-token')], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_request_must_be_json(self): response = self.app.post( '/foo', data='foobar', headers=[('Authorization', 'Bearer foo-bearer-token')], ) assert_that( response, is_bad_request()) assert_that( response, is_error_response(json.dumps(["ValidationError('Expected header: Content-type: application/json',)"])))
def test_that_non_midnight_values_are_disallowed_for_end_at(self): response = self.app.get("/foo?group_by=pie" "&end_at=2012-01-20T00:01:00Z" "&start_at=2012-01-09T00:00:00Z") assert_that(response, is_bad_request()) response = self.app.get("/foo?group_by=pie" "&end_at=2012-01-20T01:00:00Z" "&start_at=2012-01-09T00:00:00Z") assert_that(response, is_bad_request()) response = self.app.get("/foo?group_by=pie" "&end_at=2012-01-20T01:01:00Z" "&start_at=2012-01-09T00:00:00Z") assert_that(response, is_bad_request())
def test_bucket_name_validation(self): response = self.app.post( '/_foo_bucket', data = '{"foo": "bar"}', content_type = "application/json", headers=[('Authorization', 'Bearer _foo_bucket-bearer-token')], ) assert_that( response, is_bad_request() ) assert_that( response, is_error_response())
def test_data_with_empty_keys_400s(self): response = self.app.post( "/foo_bucket", data='{"": ""}', content_type="application/json", headers=[("Authorization", "Bearer foo_bucket-bearer-token")], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_data_with_empty_keys_400s(self): response = self.app.post( '/foo_data_set', data='{"": ""}', content_type="application/json", headers=[('Authorization', 'Bearer foo_data_set-bearer-token')], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_bucket_name_validation(self): response = self.app.post( '/_foo_bucket', data='{"foo": "bar"}', content_type="application/json", headers=[('Authorization', 'Bearer _foo_bucket-bearer-token')], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_invalid__id_returns_400(self): response = self.app.post( '/foo', data='{"_id": "f o o"}', content_type="application/json", headers=[('Authorization', 'Bearer foo-bearer-token')], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_invalid__id_returns_400(self): response = self.app.post( "/foo", data='{"_id": "f o o"}', content_type="application/json", headers=[("Authorization", "Bearer foo-bearer-token")], ) assert_that(response, is_bad_request()) assert_that(response, is_error_response())
def test_request_must_be_json(self): response = self.app.post( '/foo', data='foobar', headers=[('Authorization', 'Bearer foo-bearer-token')], ) assert_that(response, is_bad_request()) assert_that( response, is_error_response( json.dumps([ "ValidationError('Expected header: Content-type: application/json',)" ])))
def test_that_querying_for_raw_events_is_disabled(self): response = self.app.get("/foo?filter_by=foo:bar") assert_that(response, is_bad_request())
def test_on_invalid_dates(self): response = self.app.get("/foo?group_by=pie" "&start_at=foo" "&end_at=bar") assert_that(response, is_bad_request())
def test_request_must_be_json(self): response = self.app.post("/foo", data="foobar", headers=[("Authorization", "Bearer foo-bearer-token")]) assert_that(response, is_bad_request()) assert_that(response, is_error_response())