-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import factory | ||
import pytest | ||
from rest_framework.test import APIClient | ||
|
||
from applications.tests.factories import ApplicationFactory | ||
from common.tests.conftest import * # noqa | ||
from companies.tests.conftest import * # noqa | ||
from helsinkibenefit.tests.conftest import * # noqa | ||
|
||
|
||
@pytest.fixture | ||
def gdpr_api_client(): | ||
return APIClient() | ||
|
||
|
||
@pytest.fixture | ||
def application(mock_get_organisation_roles_and_create_company): | ||
# Application which belongs to logged in user company | ||
with factory.Faker.override_default_locale("fi_FI"): | ||
app = ApplicationFactory() | ||
app.company = mock_get_organisation_roles_and_create_company | ||
app.save() | ||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from rest_framework.reverse import reverse | ||
|
||
from common.tests.conftest import get_client_user | ||
|
||
|
||
def test_applications_unauthorized(api_client, application): | ||
response = api_client.get(reverse("users-me")) | ||
user = get_client_user(api_client) | ||
assert response.status_code == 200 | ||
assert response.data["id"] == str(user.id) | ||
assert len(response.data["csrf_token"]) > 0 |