employee test crd
This commit is contained in:
parent
d3238f50c2
commit
4a08abbfd9
|
|
@ -2,6 +2,7 @@ from rest_framework.test import APITestCase
|
||||||
from account.models import User
|
from account.models import User
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from http.cookies import SimpleCookie
|
from http.cookies import SimpleCookie
|
||||||
|
from establishment.models import Employee
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,10 +20,25 @@ class BaseTestCase(APITestCase):
|
||||||
'refresh_token': tokkens.get('refresh_token')})
|
'refresh_token': tokkens.get('refresh_token')})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EmployeeTests(BaseTestCase):
|
class EmployeeTests(BaseTestCase):
|
||||||
def test_employee_list(self):
|
def test_employee_CRD(self):
|
||||||
response = self.client.get('/api/back/establishments/employees/', format='json')
|
response = self.client.get('/api/back/establishments/employees/', format='json')
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'user': self.user.id,
|
||||||
|
'name': 'Test name'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = self.client.post('/api/back/establishments/employees/', data=data)
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
response = self.client.get('/api/back/establishments/employees/1/', format='json')
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
response = self.client.delete('/api/back/establishments/employees/1/', format='json')
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user