-
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.
- Loading branch information
Showing
16 changed files
with
756 additions
and
791 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
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import json | ||
from django.urls import reverse | ||
from rest_framework.test import APITestCase | ||
|
||
from api.models.assistant import Assistant | ||
from api.models.teacher import Teacher | ||
from api.tests.helpers import create_faculty, create_course, create_assistant, create_user | ||
from api.tests.helpers import (create_assistant, create_course, create_faculty, | ||
create_user) | ||
from authentication.models import User | ||
from django.urls import reverse | ||
from rest_framework.test import APITestCase | ||
|
||
|
||
class AssistantModelTests(APITestCase): | ||
def setUp(self) -> None: | ||
self.client.force_authenticate( | ||
self.client.force_authenticate( # type: ignore | ||
User.get_dummy_admin() | ||
) | ||
|
||
|
@@ -75,7 +77,7 @@ def test_no_assistant(self): | |
response_root = self.client.get(reverse("assistant-list"), follow=True) | ||
self.assertEqual(response_root.status_code, 200) | ||
# Assert that the response is JSON | ||
self.assertEqual(response_root.accepted_media_type, "application/json") | ||
self.assertEqual(response_root.accepted_media_type, "application/json") # type: ignore | ||
# Parse the JSON content from the response | ||
content_json = json.loads(response_root.content.decode("utf-8")) | ||
# Assert that the parsed JSON is an empty list | ||
|
@@ -96,7 +98,7 @@ def test_assistant_exists(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -131,7 +133,7 @@ def test_multiple_assistant(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -170,7 +172,7 @@ def test_assistant_detail_view(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -205,7 +207,7 @@ def test_assistant_faculty(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -223,7 +225,7 @@ def test_assistant_faculty(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -262,7 +264,7 @@ def test_assistant_courses(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -280,7 +282,7 @@ def test_assistant_courses(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
@@ -311,7 +313,7 @@ def setUp(self) -> None: | |
email="[email protected]" | ||
) | ||
|
||
self.client.force_authenticate(self.user) | ||
self.client.force_authenticate(self.user) # type: ignore | ||
|
||
def test_retrieve_assistant_list(self): | ||
""" | ||
|
@@ -333,7 +335,7 @@ def test_retrieve_assistant_list(self): | |
self.assertEqual(response.status_code, 200) | ||
|
||
# Assert that the response is JSON | ||
self.assertEqual(response.accepted_media_type, "application/json") | ||
self.assertEqual(response.accepted_media_type, "application/json") # type: ignore | ||
|
||
# Parse the JSON content from the response | ||
content_json = json.loads(response.content.decode("utf-8")) | ||
|
Oops, something went wrong.