-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,20 +41,19 @@ This is a Flask web app example where I have been utilizing gained skills and kn | |
``` | ||
6. Run main.py | ||
7. Use one of the accounts written as below to Login | ||
- Super admin user: | ||
email: [email protected] | ||
password: admin | ||
- user: | ||
email:test@email.com | ||
password: [email protected] | ||
- Super admin user: | ||
email: [email protected] | ||
password: admin | ||
- user: | ||
email:test@email.com | ||
password: [email protected] | ||
8. Register a new user | ||
|
||
9. Change user's role on ('/admin-dashboard') route. | ||
|
||
|
||
9. Change user's role and delete registered users on ('/admin-dashboard') route. | ||
|
||
## Design | ||
### Directory structure | ||
├── .github # GitHub actions | ||
├── instance # database file | ||
├── static # static files | ||
│ ├── assets # img files | ||
|
@@ -143,5 +142,71 @@ User: | |
|
||
|
||
## Testing | ||
The section will be updated as it is under development. | ||
pytest-flask is used for testing. | ||
pytest-flask is used for testing. All the test files are stored in the tests folder. | ||
Testing is connect to GitHub actions and tests are executed when commit or pull request happen. | ||
GitHub actions is still under development because of some errors. | ||
|
||
### How to run testing on your local environment | ||
1. run this command in the terminal: ```python -m pytest``` | ||
If you would like to see more details on the tests: ```python -m pytest -v``` | ||
|
||
Here is the executed result of ```python -m pytest``` . | ||
``` | ||
PS C:\folder path\flask_webapp> python -m pytest | ||
========================================================================================================= test session starts ========================================================================================================= | ||
platform win32 -- Python 3.10.11, pytest-8.3.3, pluggy-1.5.0 | ||
rootdir: C:\folder path\flask_webapp | ||
plugins: anyio-4.6.0, flask-1.3.0 | ||
collected 24 items | ||
tests\test_about.py . [ 4%] | ||
tests\test_admin.py .... [ 20%] | ||
tests\test_auth.py ...... [ 45%] | ||
tests\test_blog.py .... [ 62%] | ||
tests\test_collection.py .... [ 79%] | ||
tests\test_contact.py . [ 83%] | ||
tests\test_useful_info.py . [100%] | ||
'''' | ||
========================================================================================================== warnings summary =========================================================================================================== | ||
=================================================================================================== 24 passed, 2 warnings in 6.34s ==================================================================================================== | ||
``` | ||
|
||
|
||
Here is the executed result of ```python -m pytest -v``` . | ||
``` | ||
========================================================================================================= test session starts ========================================================================================================= | ||
platform win32 -- Python 3.10.11, pytest-8.3.3, pluggy-1.5.0 -- C:-----\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe | ||
cachedir: .pytest_cache | ||
rootdir: C:\folder path\flask_webapp | ||
plugins: anyio-4.6.0, flask-1.3.0 | ||
collected 24 items | ||
tests/test_about.py::test_about_access PASSED [ 4%] | ||
tests/test_admin.py::test_check_super_admin_exist PASSED [ 8%] | ||
tests/test_admin.py::test_admin_dashboard_access PASSED [ 12%] | ||
tests/test_admin.py::test_change_user_role PASSED [ 16%] | ||
tests/test_admin.py::test_delete_user PASSED [ 20%] | ||
tests/test_auth.py::test_register_page PASSED [ 25%] | ||
tests/test_auth.py::test_register_form PASSED [ 29%] | ||
tests/test_auth.py::test_duplicated_email_register PASSED [ 33%] | ||
tests/test_auth.py::test_login_page PASSED [ 37%] | ||
tests/test_auth.py::test_login_form PASSED [ 41%] | ||
tests/test_auth.py::test_logout PASSED [ 45%] | ||
tests/test_blog.py::test_create_new_post PASSED [ 50%] | ||
tests/test_blog.py::test_edit_post PASSED [ 54%] | ||
tests/test_blog.py::test_delete_post PASSED [ 58%] | ||
tests/test_blog.py::test_add_comment PASSED [ 62%] | ||
tests/test_collection.py::test_access_collection_page PASSED [ 66%] | ||
tests/test_collection.py::test_add_place PASSED [ 70%] | ||
tests/test_collection.py::test_edit_place PASSED [ 75%] | ||
tests/test_collection.py::test_delete_place PASSED [ 79%] | ||
tests/test_contact.py::test_access_contact_page PASSED [ 83%] | ||
tests/test_error.py::test_500_page PASSED [ 87%] | ||
tests/test_error.py::test_404_page PASSED [ 91%] | ||
tests/test_useful_info.py::test_access_useful_info_page PASSED [100%] | ||
========================================================================================================== warnings summary =========================================================================================================== | ||
=================================================================================================== 24 passed, 2 warnings in 6.46s ==================================================================================================== | ||
``` |