I made an average of three basic tests for each endpoint:
Valid data request (expecting a successful return from the endpoint)
Invalid data request (expecting an error message from the endpoint)
Invalid json data request (expecting NO unhandled exception from the endpoint)
In total, the test_api.py file has now 31 functional tests (1 is an example of how i made them)
They are in the following structure:
def test_route_explain(self) -> None:
"""
Brief description
"""
data = {
"key1": "value1",
"key2": "value2"
}
# TODO: Warning / Question tho who is coding the backend
response = True
self.assertTrue(response, 'Should be True, but was {}'.format(response))
Changes to other files:
As you might see, PyCharm automatically changed some files indentation and format, just let me know if that's a problem, i can disable it for the next PR;
As we mentioned in #93, i added the return statement to the self.db.get method;
Added the _remove_starting_slash method to the local_database.py, without it i was having some exceptions caused by the slash on the beginning of the strings;
I tried to follow the CONTRIBUTING.md in every way, if you find something that i should or should not do, please let me know.
I hope this PR is following everything you asked for.
Pull Requestor Checklist
[ ] Does backend/database/database_config.py have the type of production?
[ ] Does frontend/src/api/config.js have the correct server url, reading from the deployed instance at http://dolphinflashcards.com/api/?
Backend Unitary Tests
I made an average of three basic tests for each endpoint:
In total, the
test_api.py
file has now 31 functional tests (1 is an example of how i made them)They are in the following structure:
Changes to other files:
As you might see, PyCharm automatically changed some files indentation and format, just let me know if that's a problem, i can disable it for the next PR;
As we mentioned in #93, i added the
return
statement to theself.db.get
method;Added the _remove_starting_slash method to the
local_database.py
, without it i was having some exceptions caused by the slash on the beginning of the strings;I tried to follow the CONTRIBUTING.md in every way, if you find something that i should or should not do, please let me know.
I hope this PR is following everything you asked for.
Pull Requestor Checklist
[ ] Does
backend/database/database_config.py
have the type ofproduction
?[ ] Does
frontend/src/api/config.js
have the correct server url, reading from the deployed instance athttp://dolphinflashcards.com/api/
?[x] I hadn't changed or used the front-end
Issue #87