Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Mar 28, 2024
1 parent 0693f5e commit e40d1f1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_tiles_factory():
endpoints = OGCTilesFactory()
assert endpoints.with_common
assert endpoints.title == "OGC API"
assert len(endpoints.router.routes) == 14
assert len(endpoints.router.routes) == 15
assert len(endpoints.conforms_to) == 5

app = FastAPI()
Expand All @@ -127,7 +127,7 @@ def test_tiles_factory():
assert response.headers["content-type"] == "application/json"
assert response.json()["title"] == "OGC API"
links = response.json()["links"]
assert len(links) == 9 # 5 from tiles + 4 from common
assert len(links) == 10 # 6 from tiles + 4 from common
landing_link = [link for link in links if link["title"] == "Landing Page"][0]
assert landing_link["href"] == "http://testserver/"
tms_link = [link for link in links if link["title"] == "TileMatrixSets"][0]
Expand All @@ -150,7 +150,7 @@ def test_tiles_factory():
assert endpoints.router_prefix == "/map"
assert endpoints.with_common
assert endpoints.title == "OGC Tiles API"
assert len(endpoints.router.routes) == 14
assert len(endpoints.router.routes) == 15

app = FastAPI()
app.include_router(endpoints.router, prefix="/map")
Expand All @@ -160,7 +160,7 @@ def test_tiles_factory():
assert response.headers["content-type"] == "application/json"
assert response.json()["title"] == "OGC Tiles API"
links = response.json()["links"]
assert len(links) == 9
assert len(links) == 10
landing_link = [link for link in links if link["title"] == "Landing Page"][0]
assert landing_link["href"] == "http://testserver/map/"
tms_link = [link for link in links if link["title"] == "TileMatrixSets"][0]
Expand All @@ -180,7 +180,7 @@ def test_tiles_factory():
endpoints = OGCTilesFactory(title="OGC Tiles API", with_common=False)
assert not endpoints.with_common
assert endpoints.title == "OGC Tiles API"
assert len(endpoints.router.routes) == 12
assert len(endpoints.router.routes) == 13
assert len(endpoints.conforms_to) == 5

app = FastAPI()
Expand All @@ -203,7 +203,7 @@ def test_endpoints_factory():
endpoints = Endpoints()
assert endpoints.with_common
assert endpoints.title == "OGC API"
assert len(endpoints.router.routes) == 19
assert len(endpoints.router.routes) == 20
assert len(endpoints.conforms_to) == 11 # 5 from tiles + 6 from features

app = FastAPI()
Expand All @@ -214,7 +214,7 @@ def test_endpoints_factory():
assert response.headers["content-type"] == "application/json"
assert response.json()["title"] == "OGC API"
links = response.json()["links"]
assert len(links) == 14 # 5 from tiles + 5 from features + 4 from common
assert len(links) == 15 # 6 from tiles + 5 from features + 4 from common
landing_link = [link for link in links if link["title"] == "Landing Page"][0]
assert landing_link["href"] == "http://testserver/"
queryables_link = [
Expand All @@ -237,14 +237,14 @@ def test_endpoints_factory():
assert response.status_code == 200
assert response.headers["content-type"] == "application/json"
body = response.json()["conformsTo"]
assert len(body) > 10 # 4 from tiles + 6 from features
assert len(body) > 9 # 3 from tiles + 6 from features
assert "http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core" in body

endpoints = Endpoints(router_prefix="/ogc", title="OGC Full API", with_common=True)
assert endpoints.router_prefix == "/ogc"
assert endpoints.with_common
assert endpoints.title == "OGC Full API"
assert len(endpoints.router.routes) == 19
assert len(endpoints.router.routes) == 20
assert not endpoints.ogc_features.with_common
assert endpoints.ogc_features.router_prefix == "/ogc"
assert not endpoints.ogc_tiles.with_common
Expand All @@ -258,7 +258,7 @@ def test_endpoints_factory():
assert response.headers["content-type"] == "application/json"
assert response.json()["title"] == "OGC Full API"
links = response.json()["links"]
assert len(links) == 14
assert len(links) == 15
landing_link = [link for link in links if link["title"] == "Landing Page"][0]
assert landing_link["href"] == "http://testserver/ogc/"
queryables_link = [
Expand Down Expand Up @@ -288,7 +288,7 @@ def test_endpoints_factory():
endpoints = Endpoints(title="Tiles and Features API", with_common=False)
assert not endpoints.with_common
assert endpoints.title == "Tiles and Features API"
assert len(endpoints.router.routes) == 17 # 10 from tiles + 5 from features
assert len(endpoints.router.routes) == 18 # 11 from tiles + 5 from features
assert len(endpoints.conforms_to) == 11 # 4 from tiles + 6 from features

app = FastAPI()
Expand Down

0 comments on commit e40d1f1

Please sign in to comment.