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

add test for low zoom level tiles creation with geography type #52

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions tests/routes/test_geography.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ def test_geography_column(app):
assert response.status_code == 200
decoded = mapbox_vector_tile.decode(response.content)
assert len(decoded["default"]["features"])

response = app.get("/collections/public.my_data_geo/tiles/1/1/1")
assert response.status_code == 200
decoded = mapbox_vector_tile.decode(response.content)
assert len(decoded["default"]["features"])
33 changes: 12 additions & 21 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""Test schemas."""

public_tables = 8
public_functions = 3
pg_temp_functions = 3
myschema_tables = 1


def test_myschema(app_myschema):
"""Available tables should come from `myschema` and functions from `pg_temp`."""
collection_number = 4 # 3 custom functions + 1 tables from myschema

response = app_myschema.get("/collections")
assert response.status_code == 200
assert response.headers["content-type"] == "application/json"
Expand All @@ -19,15 +22,11 @@ def test_myschema(app_myschema):
# myschema table
assert "myschema.landsat" in ids

assert body["numberMatched"] == collection_number
assert body["numberMatched"] == pg_temp_functions + myschema_tables


def test_myschema_and_public_functions(app_myschema_public_functions):
"""Available tables should come from `myschema` and functions from `pg_temp` and `public` schema."""
collection_number = (
7 # 3 custom functions + 1 tables from myschema + 3 functions from public
)

response = app_myschema_public_functions.get("/collections")
assert response.status_code == 200
body = response.json()
Expand All @@ -46,15 +45,13 @@ def test_myschema_and_public_functions(app_myschema_public_functions):
# no tables from public
assert "public.my_data" not in ids

assert body["numberMatched"] == collection_number
assert (
body["numberMatched"] == pg_temp_functions + myschema_tables + public_functions
)


def test_myschema_and_public(app_myschema_public):
"""Available tables should come from `myschema` and `public` and functions from `pg_temp`"""
collection_number = (
12 # 3 custom functions + 1 tables from myschema + 8 tables from public
)

response = app_myschema_public.get("/collections")
assert response.status_code == 200
body = response.json()
Expand All @@ -81,13 +78,11 @@ def test_myschema_and_public(app_myschema_public):
# no public functions
assert "public.st_hexagongrid" not in ids

assert body["numberMatched"] == collection_number
assert body["numberMatched"] == pg_temp_functions + myschema_tables + public_tables


def test_public_functions(app_only_public_functions):
"""Available functions from `pg_temp` and `public` schema (no tables available)."""
collection_number = 6 # 3 custom functions + 3 functions from public

response = app_only_public_functions.get("/collections")
assert response.status_code == 200
body = response.json()
Expand All @@ -107,15 +102,11 @@ def test_public_functions(app_only_public_functions):
# no tables from public
assert "public.my_data" not in ids

assert body["numberMatched"] == collection_number
assert body["numberMatched"] == pg_temp_functions + public_functions


def test_myschema_and_public_order(app_myschema_public_order):
"""Available tables should come from `myschema` and `public` and functions from `pg_temp`"""
collection_number = (
12 # 3 custom functions + 1 tables from myschema + 8 tables from public
)

response = app_myschema_public_order.get("/collections")
assert response.status_code == 200
body = response.json()
Expand All @@ -135,4 +126,4 @@ def test_myschema_and_public_order(app_myschema_public_order):
# no public functions
assert "public.st_hexagongrid" not in ids

assert body["numberMatched"] == collection_number
assert body["numberMatched"] == pg_temp_functions + myschema_tables + public_tables