Open
Conversation
Co-authored-by: Paje-Bishop <Paje-Bishop@users.noreply.github.com>
Co-authored-by: Paje-Bishop <Paje-Bishop@users.noreply.github.com>
Co-authored-by: Paje-Bishop <Paje-Bishop@users.noreply.github.com>
Co-authored-by: allcomputersarebad <allcomputersarebad@users.noreply.github.com>
CheezItMan
reviewed
Nov 20, 2022
CheezItMan
left a comment
There was a problem hiding this comment.
Nicely done Paje & Lain. I left some comments/suggestions, if you have questions ping me on Slack.
Comment on lines
+10
to
+16
| def planet_dict(self): | ||
| return { | ||
| "id": self.id, | ||
| "name": self.name, | ||
| "description": self.description, | ||
| "mass": self.mass, | ||
| } |
| planets_result = Planet.query.all() | ||
| return jsonify([p.planet_dict() for p in planets_result]), 200 | ||
| elif request.method == "POST": | ||
| request_body = request.get_json() |
There was a problem hiding this comment.
Some validation to make sure the request_body is valid (has required fields) would be good.
| assert response.status_code == 400 | ||
|
|
||
|
|
||
| def test_delete_planet(client, two_saved_planets): |
There was a problem hiding this comment.
You should also test what happens when you delete a planet that doesn't exist.
| assert response_body == {"success": "Planet #1 successfully deleted"} | ||
|
|
||
|
|
||
| def test_update_planet(client, two_saved_planets): |
There was a problem hiding this comment.
You should also test invalid updates like when the id doesn't exist or there is an invalid request body.
| assert response_body == {"success": "Planet #1 successfully updated"} | ||
|
|
||
|
|
||
| def test_name_query(client, two_saved_planets): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.