Conversation
nancy-harris
left a comment
There was a problem hiding this comment.
Excellent job! There are some minor comments below. Great job!
Comment on lines
+34
to
+39
| from .routes.task_routes import task_bp | ||
| app.register_blueprint(task_bp) | ||
| from .routes.goal_routes import goal_bp | ||
| app.register_blueprint(goal_bp) | ||
| from .routes.goal_task_routes import goal_task_bp | ||
| app.register_blueprint(goal_task_bp) |
| @@ -3,3 +3,12 @@ | |||
|
|
|||
| class Goal(db.Model): | |||
| title = db.Column(db.String) | ||
| tasks = db.relationship("Task", back_populates="goal", lazy=True) | ||
|
|
||
| def to_dict(self): |
| @@ -2,4 +2,28 @@ | |||
|
|
|||
|
|
|||
| class Task(db.Model): | |||
Comment on lines
+12
to
+29
| def to_dict(self): | ||
| task = { | ||
| "id": self.task_id, | ||
| "title": self.title, | ||
| "description": self.description, | ||
| "is_complete": False, | ||
| } | ||
| if self.completed_at is not None: | ||
| task["is_complete"] = True | ||
| if self.goal_id is not None: | ||
| task["goal_id"] = self.goal_id | ||
| return task | ||
|
|
||
| @classmethod | ||
| def from_dict(cls, task_data): | ||
| new_task = Task(title=task_data["title"], | ||
| description=task_data["description"]) | ||
| return new_task No newline at end of file |
Comment on lines
+75
to
+90
| response = client.put("/goals/1", json={ | ||
| "title": "Updated Goal Title" | ||
| }) | ||
| response_body = response.get_json() | ||
|
|
||
| # Assert | ||
| # ---- Complete Assertions Here ---- | ||
| # assertion 1 goes here | ||
| # assertion 2 goes here | ||
| # assertion 3 goes here | ||
| # ---- Complete Assertions Here ---- | ||
| assert response.status_code == 200 | ||
| assert "goal" in response_body | ||
| assert response_body == { | ||
| "goal": { | ||
| "id": 1, | ||
| "title": "Updated Goal Title", | ||
| } | ||
| } | ||
| goal = Goal.query.get(1) | ||
| assert goal.title == "Updated Goal Title" |
Comment on lines
+95
to
+102
| response = client.put("/goals/1", json={ | ||
| "title": "Updated Goal 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 is None |
Comment on lines
+119
to
+121
| response_body = response.get_json() | ||
| assert response.status_code == 404 | ||
| assert not response_body |
Comment on lines
+126
to
+132
| response = client.delete("/goals/1") | ||
| 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 is None | ||
| assert Goal.query.all() == [] |
|
|
||
| # Assert | ||
| assert response.status_code == 404 | ||
| assert not response_body |
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.