diff --git a/donation/tests.py b/donation/tests.py new file mode 100644 index 00000000..7787231d --- /dev/null +++ b/donation/tests.py @@ -0,0 +1,31 @@ +from django.test import TestCase +from django.http import HttpResponse +from django.urls import reverse + +from rest_framework.test import APIClient + + +class CustomTestCase(TestCase): + def setUp(self) -> None: + self.client: APIClient = APIClient() + +class DonationsAPIViewTests(CustomTestCase): + url: str = reverse('api:donation:index') + + def test_get_method(self) -> None: + response: HttpResponse = self.client.get(self.url) + self.assertEqual(response.status_code, 200) + +class DonationSectionsAPIViewTests(CustomTestCase): + url: str = reverse('api:donation:sections') + + def test_get_method(self) -> None: + response: HttpResponse = self.client.get(self.url) + self.assertEqual(response.status_code, 200) + +class DonationButtonsAPIViewTests(CustomTestCase): + url: str = reverse('api:donation:buttons') + + def test_get_method(self) -> None: + response: HttpResponse = self.client.get(self.url) + self.assertEqual(response.status_code, 200) \ No newline at end of file diff --git a/donation/urls.py b/donation/urls.py index b7e32df3..89385a42 100644 --- a/donation/urls.py +++ b/donation/urls.py @@ -7,8 +7,9 @@ ) +app_name = 'donation' urlpatterns = [ - path('', DonationsAPIView.as_view()), - path('sections/', DonationSectionsAPIView.as_view()), - path('buttons/', DonationButtonsAPIView.as_view()), + path('', DonationsAPIView.as_view(), name='index'), + path('sections/', DonationSectionsAPIView.as_view(), name='sections'), + path('buttons/', DonationButtonsAPIView.as_view(), name='buttons'), ] \ No newline at end of file