Skip to content
Merged
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
Binary file added .coverage
Binary file not shown.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit = test*,*/dist-packages/*

[report]
omit = *test*,*/dist-packages/*
4 changes: 4 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Run Unit Tests
```bash
coverage run -m pytest tests/
```
2 changes: 1 addition & 1 deletion api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class HealthCheckResponse(BaseModel):
"""FastCollections - HealthCheckResponse"""

status: bool
status: str


class MediaType(str, Enum):
Expand Down
15 changes: 13 additions & 2 deletions api/routers/collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class Items(FeatureCollection):
model_config = {"arbitrary_types_allowed": True}


class TileMatrixSetLink(BaseModel):
class TileLink(BaseModel):
"""
TileMatrixSetLink model.
Based on http://docs.opengeospatial.org/per/19-069.html#_tilematrixsets
Expand All @@ -294,6 +294,16 @@ class TileMatrixSetLink(BaseModel):
model_config = {"use_enum_values": True}


class TileMatrixSetLink(BaseModel):
"""
TileMatrixSetLink model.
Based on http://docs.opengeospatial.org/per/19-069.html#_tilematrixsets
"""

tileMatrixSet: str
tileMatrixSetURI: str


class TileMatrixSetRef(BaseModel):
"""
TileMatrixSetRef model.
Expand All @@ -302,7 +312,8 @@ class TileMatrixSetRef(BaseModel):

id: str
title: Optional[str] = None
links: List[TileMatrixSetLink]
links: List[TileLink]
tileMatrixSetLinks: List[TileMatrixSetLink]


class LayerJSON(BaseModel):
Expand Down
4 changes: 4 additions & 0 deletions api/routers/collections/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ async def items(
status_code=400,
detail=f"""Column: {property} is not a column for {schema}.{table}.""",
)
if "gid" not in properties:
properties += ",gid"

if new_query_parameters:
for field in db_fields:
Expand Down Expand Up @@ -425,6 +427,8 @@ async def post_items(
status_code=400,
detail=f"""Column: {property} is not a column for {schema}.{table}.""",
)
if "gid" not in info.properties:
info.properties += ",gid"

if info.cql_filter is not None:
field_mapping = {}
Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pytest
from fastapi.testclient import TestClient

from api import main


@pytest.fixture()
def app():
with TestClient(app=main.app) as client:
yield client
Loading