AOSSIE-Org / AOSSIE-Org/EduAid

Write Unit Tests for backend

Đang mở
#69 21 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement good first issue
Ngôn ngữ chính
JavaScript
Star
171
Fork
425
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

---

## Tasks
1. **Set Up Testing Framework:**
- Install and configure `pytest` and `pytest-flask` for testing the application.

2. **Write Unit Tests for Routes:**
- Test each endpoint for expected behavior (e.g., HTTP status codes, JSON response structure, query parameters, and path parameters).

3. **Test Dependencies:**
- Mock external dependencies (e.g., databases, third-party APIs) using `unittest.mock` or `pytest-mock`.

4. **Test Application Context:**
- Ensure proper testing of the Flask app context and configurations.

5. **Organize Tests:**
- Place test files in the `tests/` directory.
- Use meaningful test function names and group related tests into separate files.

6. **Document Test Instructions:**
- Update the project README or contributing guide with steps to run tests locally.

---

## Acceptance Criteria
- [ ] All routes have at least one unit test.
- [ ] External dependencies are mocked and tested effectively.
- [ ] Tests are structured, organized, and easy to maintain.
- [ ] All tests pass when executed using `pytest`.

---

## References
- [Flask Testing Documentation](https://flask.palletsprojects.com/en/latest/testing/)
- [pytest Documentation](https://docs.pytest.org/en/latest/)
- [pytest-flask Documentation](https://pytest-flask.readthedocs.io/en/latest/)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.