-
Notifications
You must be signed in to change notification settings - Fork 0
Create configuration and database routing #24
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
Create configuration and database routing #24
Conversation
@@ -0,0 +1,14 @@ | |||
from flask import json | |||
|
|||
def test_list_should_return_empty_array(mocker, client): |
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.
Could we have type hints here?
Also, check the name of the file, I think It should be 'time_entries_namespace_test' or why not just 'time_entries_test' ?
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.
Ok
time_tracker_api/__init__.py
Outdated
init_app(flask_app) | ||
|
||
return flask_app | ||
|
||
|
||
def init_app_config(app, config_path, config_data=None): |
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.
Could we have type hints here.
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.
Sure
RepositoryModel = None | ||
|
||
|
||
def init_app(app: Flask) -> None: |
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.
Why not call this function 'init_database' directly ?
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.
There is some sort of standard that some objects like the APIs in flask Restplus have a function called init_app so they take the Flask app as a parameter and they do whatever initialization logic they need to be ready to be used by that app. So whatever module or package you add if you want to make it like pluggable to Flask this is pretty much the way to go
1c2fb43
to
ee9b4b7
Compare
ee9b4b7
to
ad77389
Compare
This PR:
pytest
to version5.2.0
, so we can usepytest-mock
.time_tracker_api.config.DefaultConfig
.whatever
database that can be taken as an example of what the access to any database should look like in a design/architecture that can be extensible.In addition, I added a refactoring of the API models for what we thought would be a better naming system.