-
Notifications
You must be signed in to change notification settings - Fork 71
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
Paper - Whit #49
base: master
Are you sure you want to change the base?
Paper - Whit #49
Conversation
…ncies to include datetime, test wave 3 passing
…Slack API using slack_sdk package
…e, per instructions, rather than slack_sdk package
…, modifies GET method to /tasks to return goal_id as part of response
…nal in response to GET request
…factors routes.py to use new methods to DRY code
… method for readability
…s/<task_id> to use method
… to optional enhancements test file, adds a fixture to conftest.py to make these tests work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! You hit the learning goals here. Nice work. I like helper functions and the tests you added. Great job.
title = db.Column(db.String) | ||
tasks = db.relationship('Task', backref='goal', lazy=True) | ||
|
||
def to_json(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great helper method!
task_info['goal_id'] = self.goal_id | ||
return task_info | ||
|
||
def from_json(self, request_body): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
def is_task_complete(self): | ||
if not self.completed_at: | ||
return False | ||
return True | ||
|
||
def get_task_info(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great helper methods
else: | ||
tasks = Task.query.all() | ||
|
||
return jsonify([task.get_task_info() for task in tasks]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice list comprehension
sort_query = request.args.get("sort") | ||
sort_by_id_query = request.args.get("sort_by_id") | ||
filter_by_query = request.args.get("filter_by_title") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing the optionals! 😀
try: | ||
new_goal = Goal(title=request_body['title']) | ||
except KeyError: | ||
return make_response({ | ||
"details": "Invalid data" | ||
}, 400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling exceptions 👍
#### Helper Functions #### | ||
########################## | ||
|
||
def post_to_slack(message): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great helper function
requests==2.25.1 | ||
six==1.15.0 | ||
slack-sdk==3.5.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're not using this anymore.
slack-sdk==3.5.1 |
# This fixture gets called in optional enchancements tests | ||
# that reference "three_goals". This fixture creates three | ||
# goals and saves them in the database | ||
@pytest.fixture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great additional fixture!
@@ -0,0 +1,175 @@ | |||
def test_get_tasks_sorted_by_id(client, three_tasks): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done with the optional tests!
With optional enhancements including additional tests and test configs