Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove API prefix parameter from links tests #201

Open
wants to merge 1 commit into
base: tests/add-paging-links-tests
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/api/test_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@


@pytest.mark.parametrize("root_path", ["", "/api/v1"])
@pytest.mark.parametrize("prefix", ["", "/stac"])
def tests_app_links(prefix, root_path):
endpoint_prefix = root_path + prefix
url_prefix = "http://stac.io" + endpoint_prefix
def tests_app_links(root_path):
url_prefix = "http://stac.io" + root_path

app = FastAPI(root_path=root_path)
router = APIRouter(prefix=prefix)
router = APIRouter()
app.state.router_prefix = router.prefix

@router.get("/search")
Expand Down Expand Up @@ -60,7 +58,7 @@ async def collections(request: Request):
base_url="http://stac.io",
root_path=root_path,
) as client:
response = client.get(f"{endpoint_prefix}/search")
response = client.get("/search")
assert response.status_code == 200
assert response.json()["url"] == url_prefix + "/search"
assert response.json()["base_url"].rstrip("/") == url_prefix
Expand All @@ -71,7 +69,7 @@ async def collections(request: Request):
assert link["href"].startswith(url_prefix)
assert {"next", "previous", "root", "self"} == {link["rel"] for link in links}

response = client.post(f"{endpoint_prefix}/search", json={})
response = client.post("/search", json={})
assert response.status_code == 200
assert response.json()["url"] == url_prefix + "/search"
assert response.json()["base_url"].rstrip("/") == url_prefix
Expand All @@ -82,7 +80,7 @@ async def collections(request: Request):
assert link["href"].startswith(url_prefix)
assert {"next", "previous", "root", "self"} == {link["rel"] for link in links}

response = client.get(f"{endpoint_prefix}/collections")
response = client.get("/collections")
assert response.status_code == 200
assert response.json()["url"] == url_prefix + "/collections"
assert response.json()["base_url"].rstrip("/") == url_prefix
Expand Down