-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
0d01e42
commit 618258c
Showing
6 changed files
with
49 additions
and
29 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 |
---|---|---|
|
@@ -43,14 +43,13 @@ class Config(BaseSettings): | |
raise ValueError("Authentication was enabled, but some auth configuration parameters are missing") | ||
|
||
if not config.AUTH_ENABLED: | ||
print("\n") | ||
print("################ WARNING ################") | ||
print("# Authentication is disabled #") | ||
print("################ WARNING ################\n") | ||
|
||
default_user: User = User( | ||
**{ | ||
"user_id": "nologin", | ||
"full_name": "Not Authenticated", | ||
"email": "[email protected]", | ||
} | ||
user_id="nologin", | ||
full_name="Not Authenticated", | ||
email="[email protected]", | ||
) |
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 |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
from starlette.status import HTTP_200_OK | ||
from starlette.testclient import TestClient | ||
|
||
from authentication.mock_token_generator import generate_mock_token | ||
from authentication.models import User | ||
from config import config | ||
from tests.integration.mock_authentication import get_mock_jwt_token | ||
|
||
pytestmark = pytest.mark.integration | ||
|
||
|
@@ -14,7 +14,7 @@ def test_whoami(self, test_app: TestClient): | |
config.AUTH_ENABLED = True | ||
config.TEST_TOKEN = True | ||
user = User(user_id="1", email="[email protected]", roles=["a"]) | ||
headers = {"Authorization": f"Bearer {generate_mock_token(user)}"} | ||
headers = {"Authorization": f"Bearer {get_mock_jwt_token(user)}"} | ||
response = test_app.get("/whoami", headers=headers) | ||
data = response.json() | ||
assert response.status_code == HTTP_200_OK | ||
|
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