modify base test for route 'employees'

This commit is contained in:
ВашÐВиктор ГладкихÐ 2019-09-19 15:40:07 +03:00
parent 4e47a5b7a4
commit 3095b5940f

View File

@ -13,20 +13,22 @@ class BaseTestCase(APITestCase):
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',
def getAuthInfo(self):
data ={
'username_or_email': self.username,
'password': self.password,
'remember': True
}
response = self.client.post('/api/auth/login/', data=data)
response = self.client.post('/api/auth/login/',data=self.data)
auth = {
return {
'access_token': response.data['access_token'],
'refresh_token': response.data['refresh_token']
}
response = self.client.get('/api/back/establishments/employees/', data=auth, format='json')
class EmployeeTests(BaseTestCase):
def test_employee_create(self):
data = self.getAuthInfo()
response = self.client.get('/api/back/establishments/employees/', data=data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)