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)