-
Notifications
You must be signed in to change notification settings - Fork 0
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
BGDIINF_SB-1971: Addaptation to new spec from doc-api-spec #20
Conversation
33115d5
to
1ac4016
Compare
This implement the new kml spec based on geoadmin/doc-api-spec - POST api/kml/admin multipart/form-data kml=<kml-file> - GET api/kml/admin/<kml_id> - PUT api/kml/admin/<kml_id> mutlipart/form-data admin_id=<admin_id> kml=<kml-file> - DEL api/kml/admin/<kml_id> multipart/form-data admin_id=<admin_id>
1ac4016
to
571edce
Compare
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.
Nice!
Now the S3 file returns the correct content-type
Nice revamping of the validations and few new test cases added, thanks! 👍 |
db.update_item_timestamp(kml_admin_id, timestamp) | ||
item = db.get_item(kml_admin_id) | ||
timestamp = datetime.utcnow().replace(tzinfo=timezone.utc).isoformat() | ||
db.update_item(kml_id, timestamp, empty) |
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.
Does it make sense to update an existing kml, in case it is to be replaced with an empty kml string? Isn't this rather a deletion then?
return inner_decorator | ||
|
||
|
||
def validate_kml_string(kml_string): |
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.
Nice additions to the validations!
response = self.app.put( | ||
url_for('update_kml', kml_id=id_to_put), | ||
data=prepare_kml_payload(self.kml_dict["updated"]), | ||
content_type="multipart/form-data", |
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.
Should be "Permission denied" in line 221 for consistency (line 221 not part of this PR)
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 changed every where to 403 Permission denied
tests/unit_tests/test_routes.py
Outdated
) | ||
self.assertEqual(response.status_code, 403) | ||
self.assertEqual(response.content_type, "application/json") | ||
self.assertEqual(response.json["error"]["message"], "Not allowed") |
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.
Picky, I know: Later on you use "Permission denied" for non allowed admin_id operations. (just for consistency)
See new spec in https://github.com/geoadmin/doc-api-specs/pull/12