feat: unify scope settings and catalog table interactions
Deploy production / deploy (push) Successful in 54s
Deploy production / deploy (push) Successful in 54s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Preparation sorting applies before pagination and rejects unsupported keys."""
|
||||
|
||||
|
||||
async def test_preparation_sort_pagination(logged_in):
|
||||
client = logged_in
|
||||
scope = {"instrument_type": "EQUITY", "region": "USA", "universe": "TOP3000", "delay": 1}
|
||||
for name in ["sort-C", "sort-A", "sort-B", "unrelated"]:
|
||||
response = await client.post("/api/v1/data-preparations", json={"name": name, "scope": scope})
|
||||
assert response.status_code == 201
|
||||
for direction, expected in [
|
||||
("asc", ["sort-A", "sort-B", "sort-C"]),
|
||||
("desc", ["sort-C", "sort-B", "sort-A"]),
|
||||
]:
|
||||
names = []
|
||||
for offset in range(3):
|
||||
response = await client.get(
|
||||
"/api/v1/data-preparations",
|
||||
params={
|
||||
"q": "sort-",
|
||||
"sort": "name",
|
||||
"direction": direction,
|
||||
"limit": 1,
|
||||
"offset": offset,
|
||||
},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["total"] == 3
|
||||
names.append(response.json()["items"][0]["name"])
|
||||
assert names == expected
|
||||
for params in [{"sort": "field_count"}, {"direction": "sideways"}]:
|
||||
assert (await client.get("/api/v1/data-preparations", params=params)).status_code == 422
|
||||
default = (await client.get("/api/v1/data-preparations")).json()
|
||||
assert default["items"][0]["name"] == "unrelated"
|
||||
Reference in New Issue
Block a user