diff --git a/app/itim/tests/unit/test_itim_viewset.py b/app/itim/tests/unit/test_itim_viewset.py new file mode 100644 index 00000000..012f6cc4 --- /dev/null +++ b/app/itim/tests/unit/test_itim_viewset.py @@ -0,0 +1,42 @@ +from django.contrib.auth.models import User +from django.shortcuts import reverse +from django.test import Client, TestCase + +from access.models import Organization + +from api.tests.abstract.viewsets import ViewSetCommon + +from itim.viewsets.index import Index + + +class ITIMViewset( + TestCase, + ViewSetCommon +): + + viewset = Index + + route_name = 'API:_api_v2_itim_home' + + + @classmethod + def setUpTestData(self): + """Setup Test + + 1. Create an organization for user + 3. create super user + """ + + organization = Organization.objects.create(name='test_org') + + self.organization = organization + + self.view_user = User.objects.create_user(username="test_user_add", password="password", is_superuser=True) + + + client = Client() + url = reverse(self.route_name + '-list') + + + client.force_login(self.view_user) + self.http_options_response_list = client.options(url) \ No newline at end of file