-
Notifications
You must be signed in to change notification settings - Fork 76
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
3 changed files
with
37 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
|
||
pytest_plugins = "quetz.testing.fixtures" | ||
|
||
|
||
@pytest.fixture | ||
def plugins(): | ||
# defines plugins to enable for testing | ||
return ['quetz-googleiap'] | ||
|
||
@pytest.fixture | ||
def sqlite_in_memory(): | ||
# use sqlite on disk so that we can modify it in a different process | ||
return False |
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,23 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"config_extra", ['[googleiam]\nserver_admin_emails=["[email protected]"]'] | ||
) | ||
def test_authentication(client, db): | ||
response = client.get("/api/me") | ||
assert response.status_code == 401 | ||
|
||
# add headers | ||
headers = { | ||
'X-Goog-Authenticated-User-Email': 'accounts.google.com:[email protected]', | ||
'X-Goog-Authenticated-User-Id': 'accounts.google.com:[email protected]', | ||
} | ||
|
||
response = client.get("/api/me", headers=headers) | ||
assert response.status_code == 200 | ||
|
||
# # check if channel was created | ||
# response = client.get("/api/channels", headers=headers) | ||
# assert response.status_code == 200 | ||
# assert response.json()['channels'][0]['name'] == 'someone' |