Open
Conversation
mikellewade
reviewed
May 22, 2025
mikellewade
left a comment
There was a problem hiding this comment.
Malik, good work on your Task list project!
Comment on lines
+7
to
9
| load_dotenv() | ||
| import os | ||
|
|
There was a problem hiding this comment.
Suggested change
| load_dotenv() | |
| import os | |
| import os | |
| load_dotenv() |
Comment on lines
+4
to
+5
| from .routes.task_routes import bp as tasks_bp | ||
| from .routes.goal_routes import bp as goals_bp |
There was a problem hiding this comment.
Nice! You are following Flask convention to by naming your Blueprints bp and then using as to import them under an alias.
Comment on lines
+24
to
+25
| app.register_blueprint(tasks_bp) | ||
| app.register_blueprint(goals_bp) |
| if config: | ||
| # Merge `config` into the app's configuration | ||
| # to override the app's default settings for testing | ||
|
|
|
|
||
| class Goal(db.Model): | ||
| id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) | ||
| title: Mapped[str] |
There was a problem hiding this comment.
Great work using the declarative mapping here! Since we are doing any specific declarations like in id we can simply use Mapped in conjunction with a Python datatype to declare what this column will look like.
|
|
||
| # Assert | ||
| assert response.status_code == 404 | ||
| assert response_body == {"message": "Task 1 is not found"} |
Comment on lines
+58
to
+59
| assert response.status_code == 404 | ||
| assert response_body == {"message": "Goal 1 is not found"} |
Comment on lines
+83
to
+92
| response = client.put("goals/1", json={ | ||
| "title": "This is my updated Task Title" | ||
| }) | ||
|
|
||
| # Assert | ||
| # ---- Complete Assertions Here ---- | ||
| # assertion 1 goes here | ||
| # assertion 2 goes here | ||
| # assertion 3 goes here | ||
| # ---- Complete Assertions Here ---- | ||
| assert response.status_code == 204 | ||
|
|
||
| query = db.select(Goal).where(Goal.id == 1) | ||
| goal = db.session.scalar(query) | ||
|
|
||
| assert goal.title == "This is my updated Task Title" |
There was a problem hiding this comment.
Nice work checking the database to make sure the changes persisted!
Comment on lines
+97
to
+103
| response = client.put("/goals/1", json={ | ||
| "title": "updated task title" | ||
| }) | ||
| response_body = response.get_json() | ||
|
|
||
| # Assert | ||
| # ---- Complete Assertions Here ---- | ||
| # assertion 1 goes here | ||
| # assertion 2 goes here | ||
| # ---- Complete Assertions Here ---- | ||
| assert response.status_code == 404 | ||
| assert response_body == {"message": "Goal 1 is not found"} |
Comment on lines
+128
to
+130
| assert response.status_code == 404 | ||
| assert response_body == {"message": "Goal 1 is not found"} | ||
| assert db.session.scalars(db.select(Goal)).all() == [] |
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.