add authenticated tests for customer views

This commit is contained in:
Andreas Zweili 2020-12-07 16:08:33 +01:00
parent 42a47e72c6
commit 0e45fa1350
1 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,13 @@ def test_unauthorized_request_owner(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_owner(api_client_authenticated):
url = reverse('owner-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_customer(api_client):
url = reverse('customer-list')
@ -17,6 +24,13 @@ def test_unauthorized_request_customer(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_customer(api_client_authenticated):
url = reverse('customer-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_device_manufacturer(api_client):
url = reverse('devicemanufacturer-list')
@ -24,8 +38,22 @@ def test_unauthorized_request_device_manufacturer(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_device_manufacturer(api_client_authenticated):
url = reverse('devicemanufacturer-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_locaton(api_client):
url = reverse('location-list')
response = api_client.get(url)
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_locaton(api_client_authenticated):
url = reverse('location-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200