Tigers - Neema and Maria Silva - Solar System API#40
Open
n2020h wants to merge 20 commits intoAda-C18:mainfrom
Open
Tigers - Neema and Maria Silva - Solar System API#40n2020h wants to merge 20 commits intoAda-C18:mainfrom
n2020h wants to merge 20 commits intoAda-C18:mainfrom
Conversation
Co-authored-by: Maria Silva
moons in assert statement
CheezItMan
reviewed
Nov 20, 2022
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Neema & Maria, you hit the basics here pretty well. I left some minor comments/suggestions. Ping me on slack if you have questions.
|
|
||
| return planet_as_dict | ||
|
|
||
| def from_json(cls, req_body): |
There was a problem hiding this comment.
This should probably be a class method
Comment on lines
+9
to
+20
| def validate_model(cls, model_id): | ||
| try: | ||
| model_id = int(model_id) | ||
| except: | ||
| abort(make_response({"message":f"{cls.__name__} {model_id} invalid"}, 400)) | ||
|
|
||
| model = cls.query.get(model_id) | ||
|
|
||
| if not model: | ||
| abort(make_response({"message":f"{cls.__name__} {model_id} not found"}, 404)) | ||
|
|
||
| return model |
|
|
||
|
|
||
| @planets_bp.route("", methods=["POST"]) | ||
| def handle_planets(): |
There was a problem hiding this comment.
Just curious, why name the function handle_planets instead of create_planet?
Comment on lines
+27
to
+28
| @pytest.fixture | ||
| def two_saved_planets(app): |
There was a problem hiding this comment.
Why not include a fixture for one planet as well?
Comment on lines
+69
to
+70
| assert response.status_code == 201 | ||
| assert response_body == "Planet New Planet successfully created" |
There was a problem hiding this comment.
You should also assert that the number of planets in the DB has increased.
| @@ -0,0 +1,70 @@ | |||
| def test_get_all_planets_with_no_records(client): | |||
There was a problem hiding this comment.
Just noting that there are no tests for the delete or update actions.
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.