Test files are located in dev-backend/flask_docker/unittests
For now, to run this test:
- cd to docker_code and run 'python3 -m unittest -v <path_to_test_file>' (eg. 'python3 -m unittest -v unittests/Sample/model_test.py')
Note: Please run the unit test in the docker container: under www/var (reference: Dev/Debug in Container)
Otherwise, you will need to install all dependencies in your local env.
User model/api test functions | Doc |
---|---|
model_test.py/test_user_create | test if a user can be created correctly |
model_test.py/create_user | helper function to create a user |
model_test.py/test_generate_password_hash | test if a password hash can be generate correctly |
model_test.py/test_check_password_hash | test if the password checking working properly |
api_test.py/test_app_is_testing | test if the app is running in TEST mode |
api_test.py/register | helper function to register a new user by API |
api_test.py/test_register | test if a user can be registered correctly via register API |
api_test.py/test_login | test if a user can logged in with credentials via log in API |
api_test.py/test_logout | test if a user can logout via log out API |
Sample model/api test functions | Doc |
---|---|
model_test.py/test_sample_create | test if a sample instance can be created |
model_test.py/test_app_is_testing | test if the app is running in TEST mode |
model_test.py/test_get_sample_api | test if we can get all samples data correctly via get sample list API |
model_test.py/test_post_sample_api | test if we can upload a sample data via add sample API |
model_test.py/test_get_sample_by_infant_id_api | test if we can get all samples data of a specific infant via get sample by infant id API |