Skip to content

Commit

Permalink
fixed tests maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
Vucis committed May 4, 2024
1 parent bbbb5d2 commit 536a2e7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions backend/tests/endpoints/course/courses_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_data_fields(self, data_field_type_test: tuple[str, Any, str, dict[str,
### QUERY PARAMETER ###
# Test a query parameter, should return [] for wrong values
query_parameter_tests = \
query_parameter_tests("/courses", "get", "student", [f.name for f in fields(Course)])
query_parameter_tests("/courses", "get", "teacher", [f.name for f in fields(Course)])

@mark.parametrize("query_parameter_test", query_parameter_tests, indirect=True)
def test_query_parameters(self, query_parameter_test: tuple[str, Any, str, bool]):
Expand All @@ -127,7 +127,7 @@ def test_query_parameters(self, query_parameter_test: tuple[str, Any, str, bool]
### COURSES ###
def test_get_courses(self, client: FlaskClient, courses: list[Course]):
"""Test getting all courses"""
csrf = get_csrf_from_login(client, "student")
csrf = get_csrf_from_login(client, "teacher")
response = client.get("/courses", headers = {"X-CSRF-TOKEN":csrf})
assert response.status_code == 200
data = [course["name"] for course in response.json["data"]]
Expand Down Expand Up @@ -222,7 +222,6 @@ def test_post_courses(self, client: FlaskClient, teacher: User):
}
)
assert response.status_code == 201
csrf = get_csrf_from_login(client, "student")
response = client.get("/courses?name=test", headers = {"X-CSRF-TOKEN":csrf})
assert response.status_code == 200
data = response.json["data"][0]
Expand Down

0 comments on commit 536a2e7

Please sign in to comment.