Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JarneClauw committed Apr 5, 2024
1 parent 8e572f7 commit 8730001
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions backend/tests/endpoints/course/courses_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_get_courses_all(self, client: FlaskClient, courses: List[Course]):
data = [course["name"] for course in response.json["data"]]
assert all(course.name in data for course in courses)

def test_get_courses_wrong_parameter(self, client: FlaskClient):
def test_get_courses_wrong_argument(self, client: FlaskClient):
"""Test getting courses for a wrong parameter"""
response = client.get("/courses?parameter=0", headers = {"Authorization": "student"})
assert response.status_code == 400
Expand Down Expand Up @@ -285,7 +285,7 @@ def test_patch_course_incorrect_field(self, client: FlaskClient, course: Course)
response = client.patch(
f"/courses/{course.course_id}",
headers = {"Authorization": "teacher"},
json = {"field": 0}
json = {"incorrect": 0}
)
assert response.status_code == 400

Expand Down Expand Up @@ -386,7 +386,7 @@ def test_post_students_incorrect_field(
assert response.status_code == 400

def test_post_students_correct(
self, client: FlaskClient, course: Course, student_other: User
self, client: FlaskClient, api_host: str, course: Course, student_other: User
):
"""Test adding students to a course"""
response = client.post(
Expand All @@ -397,8 +397,7 @@ def test_post_students_correct(
}
)
assert response.status_code == 201
data = response.json["data"][0]
assert not data
assert response.json["data"]["students"][0] == f"{api_host}/users/student_other"



Expand Down Expand Up @@ -584,7 +583,7 @@ def test_delete_admins_correct(self, client: FlaskClient, course: Course, admin:
"admin_uid": admin.uid
}
)
assert response.status_code == 200
assert response.status_code == 204
response = client.get(
f"/courses/{course.course_id}/admins",
headers = {"Authorization": "teacher"}
Expand Down

0 comments on commit 8730001

Please sign in to comment.