-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
12 changed files
with
305 additions
and
23 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytest | ||
|
||
from helpers.http_methods_helpers import get | ||
|
||
|
||
@pytest.mark.benchmark | ||
@pytest.mark.parametrize("function_type", ["sync", "async"]) | ||
def test_valid_authentication(session, function_type: str): | ||
r = get(f"/{function_type}/auth", headers={"Authorization": "Bearer valid"}) | ||
assert r.text == "authenticated" | ||
|
||
|
||
@pytest.mark.benchmark | ||
@pytest.mark.parametrize("function_type", ["sync", "async"]) | ||
def test_invalid_authentication_token(session, function_type: str): | ||
r = get( | ||
f"/{function_type}/auth", | ||
headers={"Authorization": "Bearer invalid"}, | ||
should_check_response=False, | ||
) | ||
assert r.status_code == 401 | ||
assert r.headers["WWW-Authenticate"] == "BearerGetter" | ||
|
||
|
||
@pytest.mark.benchmark | ||
@pytest.mark.parametrize("function_type", ["sync", "async"]) | ||
def test_invalid_authentication_header(session, function_type: str): | ||
r = get( | ||
f"/{function_type}/auth", | ||
headers={"Authorization": "Bear valid"}, | ||
should_check_response=False, | ||
) | ||
assert r.status_code == 401 | ||
assert r.headers["WWW-Authenticate"] == "BearerGetter" | ||
|
||
|
||
@pytest.mark.benchmark | ||
@pytest.mark.parametrize("function_type", ["sync", "async"]) | ||
def test_invalid_authentication_no_token(session, function_type: str): | ||
r = get(f"/{function_type}/auth", should_check_response=False) | ||
assert r.status_code == 401 | ||
assert r.headers["WWW-Authenticate"] == "BearerGetter" |
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
Oops, something went wrong.