Skip to content
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

Merged
merged 4 commits into from
Sep 15, 2021

Conversation

ltshb
Copy link
Contributor

@ltshb ltshb commented Sep 14, 2021

@ltshb ltshb force-pushed the feature_BGDIINF_SB-1971_new_spec branch 2 times, most recently from 33115d5 to 1ac4016 Compare September 14, 2021 13:18
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>
@ltshb ltshb force-pushed the feature_BGDIINF_SB-1971_new_spec branch from 1ac4016 to 571edce Compare September 14, 2021 13:29
@ltshb ltshb requested review from hansmannj, ltkum, IsabelleBzr and boecklic and removed request for ltkum September 14, 2021 13:41
Copy link
Contributor

@boecklic boecklic left a 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
@ltshb
Copy link
Contributor Author

ltshb commented Sep 14, 2021

@boecklic I added the 'Content-Type: application/vnd.google-earth.kml+xml' to the S3 file (see last commit c580e83), I guess that's also ok for you ?

@hansmannj
Copy link
Member

Nice revamping of the validations and few new test cases added, thanks! 👍

app/routes.py Show resolved Hide resolved
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)
Copy link
Member

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):
Copy link
Member

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",
Copy link
Member

@hansmannj hansmannj Sep 15, 2021

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)

Copy link
Contributor Author

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

)
self.assertEqual(response.status_code, 403)
self.assertEqual(response.content_type, "application/json")
self.assertEqual(response.json["error"]["message"], "Not allowed")
Copy link
Member

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)

@ltshb ltshb merged commit 354ef79 into develop Sep 15, 2021
@ltshb ltshb deleted the feature_BGDIINF_SB-1971_new_spec branch September 15, 2021 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants