27 lines
1005 B
Python
27 lines
1005 B
Python
from src.core.public_paths import public_endpoint_specs
|
|
|
|
|
|
def test_login_page_is_public_without_root():
|
|
specs = public_endpoint_specs("")
|
|
assert ("start", "/login") in specs
|
|
assert ("absolute", "/") in specs
|
|
assert ("absolute", "/api/v1/auth/login") in specs
|
|
|
|
|
|
def test_login_page_is_public_with_root_path():
|
|
specs = public_endpoint_specs("/aurora/apps/fastapi-tsygankov-test")
|
|
assert ("start", "/login") in specs
|
|
assert ("start", "/aurora/apps/fastapi-tsygankov-test/login") in specs
|
|
assert ("absolute", "/aurora/apps/fastapi-tsygankov-test/api/v1/auth/login") in specs
|
|
|
|
|
|
def test_api_routes_except_login_and_ws_are_not_public():
|
|
specs = public_endpoint_specs("/aurora/apps/fastapi-tsygankov-test")
|
|
api_paths = [path for _, path in specs if "/api/" in path]
|
|
assert api_paths == [
|
|
"/api/v1/auth/login",
|
|
"/aurora/apps/fastapi-tsygankov-test/api/v1/auth/login",
|
|
"/api/v1/ws",
|
|
"/aurora/apps/fastapi-tsygankov-test/api/v1/ws",
|
|
]
|