add authenticated tests for core views

This commit is contained in:
Andreas Zweili 2020-12-07 16:03:09 +01:00
parent 0834f38046
commit 42a47e72c6
1 changed files with 35 additions and 0 deletions

View File

@ -10,6 +10,13 @@ def test_unauthorized_request_weekday(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_weekday(api_client_authenticated):
url = reverse('weekday-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_month(api_client):
url = reverse('month-list')
@ -17,6 +24,13 @@ def test_unauthorized_request_month(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_month(api_client_authenticated):
url = reverse('month-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_day_of_month(api_client):
url = reverse('dayofmonth-list')
@ -24,6 +38,13 @@ def test_unauthorized_request_day_of_month(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_day_of_month(api_client_authenticated):
url = reverse('dayofmonth-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_hours_in_day(api_client):
url = reverse('hoursinday-list')
@ -31,8 +52,22 @@ def test_unauthorized_request_hours_in_day(api_client):
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_hours_in_day(api_client_authenticated):
url = reverse('hoursinday-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200
@pytest.mark.django_db
def test_unauthorized_request_minutes_in_hour(api_client):
url = reverse('minutesinhour-list')
response = api_client.get(url)
assert response.status_code == 403
@pytest.mark.django_db
def test_authorized_request_minutes_in_hour(api_client_authenticated):
url = reverse('minutesinhour-list')
response = api_client_authenticated.get(url)
assert response.status_code == 200