Skip to content

Commit 141e2c4

Browse files
committed
Implemented more tests
1 parent 394cc9e commit 141e2c4

File tree

7 files changed

+30
-39
lines changed

7 files changed

+30
-39
lines changed

src/PRIP/config/Catalog/GETFileResponse.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
{
114114
"Name": "coordinates",
115115
"ValueType": "String",
116-
"Value": "-59.3169 2.6367,-63.105 -14.0539,-60.8506 -14.4245,-57.13092.3269,-59.3169 2.6367'"
116+
"Value": "-59.3169 2.6367,-63.105 -14.0539,-60.8506 -14.4245,-57.13092.3269,-59.3169 2.6367"
117117
},
118118
{
119119
"Name": "orbitDirection",

src/PRIP/poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PRIP/prip_station_mock.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def ready_live_status():
4747
# @token_required to be activated later
4848
@additional_options
4949
def query_products():
50+
if "$filter" not in request.args:
51+
return Response(status=HTTPStatus.OK, response=prepare_response_odata_v4(data), headers=request.args)
5052
odata_filter = request.args["$filter"]
5153
geo_products = []
5254
all_id_sets = []
@@ -56,20 +58,21 @@ def query_products():
5658
odata_filter = remove_intersects(request.args['$filter'])
5759
ids = {p['Id'] for p in geo_products}
5860
all_id_sets.append(ids)
59-
# use lexer to parse request, split it into field: {op, value}
60-
processed_filters = parse_odata_filter(odata_filter)
61-
# XAND?
62-
for filter_key, conditions in processed_filters.items():
63-
for cond in (conditions if isinstance(conditions, list) else [conditions]):
64-
products = process_products(
65-
filter_key,
66-
cond['op'],
67-
cond['value']
68-
)
69-
70-
# store only id of the result
71-
ids = {p['Id'] for p in products}
72-
all_id_sets.append(ids)
61+
if odata_filter:
62+
# use lexer to parse request, split it into field: {op, value}
63+
processed_filters = parse_odata_filter(odata_filter)
64+
# XAND?
65+
for filter_key, conditions in processed_filters.items():
66+
for cond in (conditions if isinstance(conditions, list) else [conditions]):
67+
products = process_products(
68+
filter_key,
69+
cond['op'],
70+
cond['value']
71+
)
72+
73+
# store only id of the result
74+
ids = {p['Id'] for p in products}
75+
all_id_sets.append(ids)
7376
# create set intersection, XAND, exclusive and beetween requests
7477
if not all_id_sets:
7578
common_ids = set()

src/PRIP/pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "rs-python"
2+
name = "rs-prip"
33
authors = []
44
dynamic = ["version"]
55

@@ -14,7 +14,8 @@ dependencies = [
1414
"dotenv == 0.9.9",
1515
"odata-query (>=0.10.0,<0.11.0)",
1616
"pytest (>=8.4.1,<9.0.0)",
17-
"shapely (>=2.1.1,<3.0.0)"
17+
"shapely (>=2.1.1,<3.0.0)",
18+
"werkzeug (<3.0.0)"
1819
]
1920

2021

@@ -33,3 +34,6 @@ dotenv = "^0.9.9"
3334
[build-system]
3435
requires = ["poetry-core"]
3536
build-backend = "poetry.core.masonry.api"
37+
38+
[tool.pytest.ini_options]
39+
pythonpath = "."

src/common/pagination.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def prepare_response_odata_v4(resp_body: list | map) -> Any:
1313
:return: A JSON string representing the OData v4 response.
1414
:rtype: str
1515
"""
16+
1617
unpacked = list(resp_body) if not isinstance(resp_body, list) else resp_body
1718
try:
1819
data = json.dumps(dict(value=unpacked)) # if len(unpacked) > 1 else json.dumps(unpacked[0])
File renamed without changes.

tests/conftest.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from src.ADGS.adgs_station_mock import create_adgs_app
1212
from src.CADIP.cadip_station_mock import create_cadip_app
1313
from src.LTA.lta_station_mock import create_lta_app
14-
from src.PRIP.prip_station_mock import create_prip_app
1514
from src.common.common_routes import EMPTY_AUTH_CONFIG
1615

1716
@pytest.fixture(name="empty_token_dict")
@@ -94,22 +93,6 @@ def adgs_client():
9493
# Deactivate the application context
9594
ctx.pop()
9695

97-
@pytest.fixture
98-
def prip_client():
99-
"""Docstring to be added."""
100-
app = create_prip_app()
101-
102-
# We create and activate an application context to keep the application running
103-
# during all requests of the current pytest
104-
ctx = app.app_context()
105-
ctx.push()
106-
app.testing = True
107-
with app.test_client() as client:
108-
yield client
109-
# Deactivate the application context
110-
ctx.pop()
111-
112-
11396
@pytest.fixture
11497
def lta_client():
11598
"""LTA app comm."""

0 commit comments

Comments
 (0)