diff --git a/apps/establishment/tests.py b/apps/establishment/tests.py index 7ce503c2..b6a2b9c4 100644 --- a/apps/establishment/tests.py +++ b/apps/establishment/tests.py @@ -1,3 +1,32 @@ -from django.test import TestCase - +from rest_framework.test import APITestCase, APIClient +from account.models import User +from rest_framework import status # Create your tests here. + + +class BaseTestCase(APITestCase): + + def setUp(self): + self.username = 'sedragurda' + self.password = 'sedragurdaredips19' + self.email = 'sedragurda@desoz.com' + self.newsletter = True + self.user = User.objects.create_user(username=self.username, email=self.email, password=self.password) + + +class EmployeeTests(BaseTestCase): + def test_employee_create(self): + self.data ={ + 'username_or_email': 'sedragurda', + 'password': 'sedragurdaredips19', + 'remember': True + } + + response = self.client.post('/api/auth/login/',data=self.data) + + auth = { + 'access_token': response.data['access_token'], + 'refresh_token': response.data['refresh_token'] + } + response = self.client.get('/api/back/establishments/employees/', data=auth, format='json') + self.assertEqual(response.status_code, status.HTTP_200_OK) \ No newline at end of file