-
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.
* added enrollment handler route * fixed unit testing * HOTFIX: FIXES IN GET STUDENT COURSE DATA * fixed course seats check
- Loading branch information
1 parent
3eb9892
commit c778a8b
Showing
4 changed files
with
136 additions
and
7 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
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from test.test_fixtures import * | ||
|
||
def test_approve_enrollment(authorized_client, test_enrollment, test_verified_admin_1): | ||
res = authorized_client.patch(f"/course/enrollment_update/0",json={'email': '[email protected]', 'password': 'password', 'student_id': test_enrollment[2].student_id, 'course_id': test_enrollment[2].course_id, 'comment': None}) | ||
|
||
assert res.status_code == 201 | ||
assert test_enrollment[2].status == course_model.StatusEnum.approved | ||
|
||
def test_decline_enrollment(authorized_client, test_enrollment, test_verified_admin_1): | ||
res = authorized_client.patch(f"/course/enrollment_update/1",json={'email': '[email protected]', 'password': 'password', 'student_id': test_enrollment[2].student_id, 'course_id': test_enrollment[2].course_id, 'comment': None}) | ||
|
||
assert res.status_code == 201 | ||
assert test_enrollment[2].status == course_model.StatusEnum.declined | ||
|
||
def test_invalid_enrollment(authorized_client, test_enrollment, test_verified_admin_1): | ||
res = authorized_client.patch(f"/course/enrollment_update/2",json={'email': '[email protected]', 'password': 'password', 'student_id': test_enrollment[2].student_id, 'course_id': test_enrollment[2].course_id, 'comment': None}) | ||
|
||
assert res.status_code == 422 | ||
assert res.json()["detail"] == "dir must be either 0 or 1" | ||
|
||
def test_enrollment_for_non_exisitant_entry(authorized_client, test_enrollment, test_verified_admin_1): | ||
res = authorized_client.patch(f"/course/enrollment_update/0",json={'email': '[email protected]', 'password': 'password', 'student_id': test_enrollment[2].student_id + 1, 'course_id': test_enrollment[2].course_id - 1, 'comment': None}) | ||
|
||
assert res.status_code == 404 | ||
assert res.json()["detail"] == "no such enrollment request found" |