Skip to content

Implement Pytest automation tests and GitHub workflow#21

Merged
karastoyanov merged 18 commits into
masterfrom
test/pytest-register
Jan 30, 2026
Merged

Implement Pytest automation tests and GitHub workflow#21
karastoyanov merged 18 commits into
masterfrom
test/pytest-register

Conversation

@karastoyanov
Copy link
Copy Markdown
Contributor

📝 Description

This PR adds automated testing for the backend:
• Adds pytest setup with fixtures for Flask app and in-memory SQLite database.
• Creates dummy JSON test data for /register route scenarios (valid registration, weak passwords, missing fields, duplicate usernames).
• Adds Pytest tests covering registration functionality to ensure backend correctness.
• Implements a GitHub Actions workflow that runs all backend tests on every pull request to master, enforcing CI/CD best practices.


🔗 Linked Issue (Required)

Closes: #13


🧪 Testing

  • Verified that all tests run successfully locally using pytest.
pytest -v # Needs to be executed from backend/ directory

🎓 Learning Reflection


📸 Screenshots / Logs (if applicable)

platform darwin -- Python 3.9.6, pytest-8.4.2, pluggy-1.6.0 -- <path-to-local-venv-python3>
cachedir: .pytest_cache
rootdir: <local-path-to-rootdir>
plugins: flask-1.3.0
collected 4 items

tests/test_auth_register.py::test_register_success PASSED                                                                                                                    [ 25%]
tests/test_auth_register.py::test_register_weak_password PASSED                                                                                                              [ 50%]
tests/test_auth_register.py::test_register_missing_fields PASSED                                                                                                             [ 75%]
tests/test_auth_register.py::test_register_duplicate_username PASSED                                                                                                         [100%]

================================================================================ 4 passed in 0.76s =================================================================================

MishoBankata and others added 13 commits January 29, 2026 23:36
…ion feature to app.py; Created .env file with placeholder values
… single quotes to double quotes in json responses in auth_routes.py; removed my .env from remote repo and altered gitignore so it won't get pushed again; Removed one unnecessary import from app.py and moved the other one to the top of the file
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
- Improved errors handling
- Fixed UsersStats class and relations

Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
- modified dir structure
- add pytest and flask-pytest libs
- introduce backend test with dummy data

Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
karastoyanov and others added 5 commits January 30, 2026 14:33
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
Signed-off-by: Aleksandar Karastoyanov <a.karastoyanov@utp.bg>
@karastoyanov karastoyanov merged commit f16559e into master Jan 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Pytest Unit Tests for Register and Login Functionality

2 participants