-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(endpoints-&-view): adds tests for the endpoints
also adds test for view home - redirect
- Loading branch information
Showing
2 changed files
with
234 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from rest_framework import status | ||
from rest_framework.test import APIClient | ||
|
||
BASE_URL = "http://testserver/api" | ||
|
||
|
||
class CoreViewsTest(TestCase): | ||
def setUp(self): | ||
self.client = APIClient() | ||
self.home_url = f"{BASE_URL}/" | ||
|
||
def test_home_redirect(self): | ||
res = self.client.get(self.home_url) | ||
self.assertEqual(res.status_code, status.HTTP_302_FOUND) | ||
self.assertRedirects(res, reverse("schema-swagger-ui")) |