build: configure pytest-django and add dev dependencies#40
Conversation
A-lexisL
left a comment
There was a problem hiding this comment.
- tests should be comprehensive, so more tests are needed. Please arrange them into classes based on API and Authenticated status.
e.g.
class TestCourseListAuthenticated
class TestCourseListNotAuthenticated
class TestCourseDetailAuthenticated
...
| url = reverse("user_review_api", kwargs={"review_id": review.id}) | ||
| response = auth_client.delete(url) | ||
| assert response.status_code == 204 | ||
| assert Review.objects.filter(id=review.id).count() == 0 |
There was a problem hiding this comment.
Missing tests for base_client
There was a problem hiding this comment.
Added unauthenticated coverage in TestReviewAPIUnauthenticated for list, personal list, delete, and detail in apps/web/tests/test_review.py. Evidence: .venv/bin/pytest apps/web/tests -> 52 passed.
There was a problem hiding this comment.
Added concrete diff for missing base_client tests:
+class TestReviewAPIUnauthenticated:
+ def test_get_course_reviews_anonymous(...):
+ def test_get_personal_reviews_anonymous(...):
+ def test_delete_review_anonymous_forbidden(...):
+ def test_review_detail_anonymous_forbidden(...):This adds unauthenticated coverage for the review endpoints.
…fix the format of the course code later
d40df23 to
bc0334e
Compare
…sc and desc) pagnition)
A-lexisL
left a comment
There was a problem hiding this comment.
The tests are comprehensive. But some test cases still need polishing.
| term_data | ||
| and term_data.group("year") == "16" | ||
| and term_data.group("term") == "w" | ||
| and term_data.group("term") == "F" |
There was a problem hiding this comment.
Fixed the term regex test to check 16W, 16w, and 16F separately in apps/web/tests/lib_tests/test_terms.py. Evidence: .venv/bin/pytest apps/web/tests -> 52 passed.
There was a problem hiding this comment.
Added concrete diff for the term assertion fix:
term_data = terms.term_regex.match("16w")
self.assertTrue(
term_data
and term_data.group("year") == "16"
- and term_data.group("term") == "w"
- and term_data.group("term") == "F"
+ and term_data.group("term") == "w"
)
+term_data = terms.term_regex.match("16F")
+self.assertTrue(
+ term_data
+ and term_data.group("year") == "16"
+ and term_data.group("term") == "F"
+)This removes the contradictory condition and tests both cases explicitly.
f0ba2fa to
5a7a0b1
Compare
This reverts commit 88ba7f6.
No description provided.