Skip to content

Commit

Permalink
Test User detail view for code 200, if url exists, if valid user
Browse files Browse the repository at this point in the history
  • Loading branch information
Awakhiwekyle committed Mar 11, 2024
1 parent a666ab3 commit b3f983a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_post_create_view(self):
response, self.relative_profile_url, status_code=status.HTTP_201_CREATED
)


class APIRootTestCase(TestCase):
def test_root_status_code(self):
"""
Expand All @@ -81,6 +82,7 @@ def test_root_status_code(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertTrue(response.content)


class UserTestCase(TestCase):
def setUp(self):
self.user = CustomUser.objects.create(
Expand All @@ -97,7 +99,6 @@ def test_user_detail_view(self):
"""
url = reverse("api:user-detail", kwargs={"pk": self.user.pk})
response = self.client.get(url)

self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(url, f'/api/users/{self.user.pk}/')
self.assertEqual(response.json()["username"], "test_user")
Expand Down

0 comments on commit b3f983a

Please sign in to comment.