New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added details attribute to 404 errors. #861
Changes from 14 commits
708cb9b
4190c44
7d9631a
f68d999
e4fdefc
3a1dc00
3394b9f
23e8ef1
c732448
bd3c5a6
714fd27
a5e9291
fb79170
9e15b99
a47bba5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,15 +44,15 @@ def test_404_is_valid_formatted_error(self): | |
self.assertFormattedError(response, 404, ERRORS.MISSING_RESOURCE, "Not Found", | ||
"The resource you are looking for could not be found.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this still be a normal 404? Why are we removing this test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we want to add the details attribute to all 404 errors as in the normal 404 should also contain a details attribute in the response. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the test should be removed from here though ;) As Ethan suggested, you can add more tests in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the valid format of a 404 error contain the details attribute as well, now? If yes, then I think this test should be modified to ensure that the error contains details. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well indeed, you could modify this test a bit, but not too much. It would be complementary with the new ones in |
||
|
||
def test_404_can_be_overridded(self): | ||
def test_404_can_be_overridden(self): | ||
custom_404 = http_error(httpexceptions.HTTPNotFound(), | ||
errno=ERRORS.MISSING_RESOURCE, | ||
message="Customized.") | ||
with mock.patch('tests.core.testapp.views.Mushroom._extract_filters', | ||
side_effect=custom_404): | ||
response = self.app.get(self.sample_url, headers=self.headers, status=404) | ||
self.assertFormattedError( | ||
response, 404, ERRORS.MISSING_RESOURCE, "Not Found", "Customized.") | ||
self.assertFormattedError(response, 404, ERRORS.MISSING_RESOURCE, | ||
"Not Found", "Customized.") | ||
|
||
def test_401_is_valid_formatted_error(self): | ||
response = self.app.get(self.sample_url, status=401) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,8 +197,8 @@ def setUp(self): | |
r = self.app.post_json(self.collection_url + '/records', | ||
MINIMALIST_RECORD, | ||
headers=self.headers) | ||
record_id = r.json['data']['id'] | ||
self.record_url = self.collection_url + '/records/%s' % record_id | ||
self.record_id = r.json['data']['id'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to add |
||
self.record_url = self.collection_url + '/records/%s' % self.record_id | ||
# Delete the bucket. | ||
self.app.delete(self.bucket_url, headers=self.headers) | ||
|
||
|
@@ -228,6 +228,7 @@ def test_every_collections_are_deleted_too(self): | |
self.app.put_json(self.bucket_url, MINIMALIST_BUCKET, | ||
headers=self.headers) | ||
self.app.get(self.collection_url, headers=self.headers, status=404) | ||
|
||
# Verify tombstones | ||
resp = self.app.get('%s/collections?_since=0' % self.bucket_url, | ||
headers=self.headers) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think details can be on the same line.