-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for passing admin_emails via configuration
- Loading branch information
Showing
9 changed files
with
38 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,11 @@ class Settings(BaseSettings): | |
session_expiry_days: int = 10 | ||
login_expiry_days: int = 10 | ||
|
||
admin_emails: List[str] = [ | ||
"[email protected]", | ||
"[email protected]", | ||
] | ||
|
||
aws_region: str = "" | ||
aws_access_key_id: str = "" | ||
aws_secret_access_key: str = "" | ||
|
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
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,14 +1,11 @@ | ||
from unittest.mock import MagicMock | ||
import pytest | ||
|
||
import time | ||
import jwt | ||
|
||
from fastapi.testclient import TestClient | ||
|
||
from ooniauth.common.config import Settings | ||
from ooniauth.common.dependencies import get_settings | ||
from ooniauth.dependencies import get_ses_client, get_clickhouse_client | ||
from ooniauth.dependencies import get_ses_client | ||
from ooniauth.utils import hash_email_address | ||
from ooniauth.main import app | ||
|
||
|
@@ -23,7 +20,7 @@ def override_get_settings(): | |
@pytest.fixture | ||
def client_with_bad_settings(): | ||
app.dependency_overrides[get_settings] = make_override_get_settings( | ||
postgresql_url="postgresql://bad:bad@localhost/bad" | ||
postgresql_url="postgresql://bad:bad@localhost/bad", | ||
) | ||
|
||
client = TestClient(app) | ||
|
@@ -32,12 +29,13 @@ def client_with_bad_settings(): | |
|
||
@pytest.fixture | ||
def user_email(): | ||
return "[email protected]" | ||
# NSA shall never be an admin user, lol | ||
return "[email protected]" | ||
|
||
|
||
@pytest.fixture | ||
def admin_email(): | ||
return "dev+adminaccount@ooni.org" | ||
return "admin@ooni.org" | ||
|
||
|
||
@pytest.fixture | ||
|
@@ -95,6 +93,7 @@ def client( | |
email_source_address=email_source_address, | ||
account_id_hashing_key=account_id_hashing_key, | ||
aws_access_key_id="ITSCHANGED", | ||
admin_emails=[admin_email], | ||
aws_secret_access_key="ITSCHANGED", | ||
) | ||
mock_clickhouse = MagicMock() | ||
|
@@ -112,8 +111,5 @@ def mock_execute(query, query_params, with_column_types, settings): | |
|
||
return [("user",)], [("role", "String")] | ||
|
||
mock_clickhouse.execute = mock_execute | ||
app.dependency_overrides[get_clickhouse_client] = lambda: mock_clickhouse | ||
|
||
client = TestClient(app) | ||
yield client |
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