added comodities
This commit is contained in:
@@ -11,14 +11,24 @@ def test_healthz():
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["status"] == "ok"
|
||||
assert body["counts"] == {"ships": 2, "ship-items": 2, "fps-items": 1}
|
||||
assert body["counts"] == {
|
||||
"ships": 2,
|
||||
"ship-items": 2,
|
||||
"fps-items": 1,
|
||||
"commodities": 4,
|
||||
}
|
||||
|
||||
|
||||
def test_stats():
|
||||
resp = client.get("/api/v1/stats")
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["categories"] == {"ships": 2, "ship-items": 2, "fps-items": 1}
|
||||
assert body["categories"] == {
|
||||
"ships": 2,
|
||||
"ship-items": 2,
|
||||
"fps-items": 1,
|
||||
"commodities": 4,
|
||||
}
|
||||
assert body["manufacturers"] == 4
|
||||
|
||||
|
||||
@@ -33,11 +43,11 @@ def test_items_default_pagination():
|
||||
resp = client.get("/api/v1/items")
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["total"] == 5
|
||||
assert body["total"] == 9
|
||||
assert body["page"] == 1
|
||||
assert body["page_size"] == 25
|
||||
assert body["total_pages"] == 1
|
||||
assert len(body["items"]) == 5
|
||||
assert len(body["items"]) == 9
|
||||
|
||||
|
||||
def test_items_page_size_capped():
|
||||
@@ -155,3 +165,29 @@ def test_deterministic_sort_order():
|
||||
body = client.get("/api/v1/items", params={"page_size": 100}).json()
|
||||
keys = [(i["category"], i["name"].lower()) for i in body["items"]]
|
||||
assert keys == sorted(keys)
|
||||
|
||||
|
||||
def test_items_category_filter_commodities():
|
||||
resp = client.get("/api/v1/items", params={"category": "commodities"})
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["total"] == 4
|
||||
assert all(i["category"] == "commodities" for i in body["items"])
|
||||
|
||||
|
||||
def test_items_search_matches_refined_and_ore_iron():
|
||||
resp = client.get("/api/v1/items", params={"search": "iron"})
|
||||
body = resp.json()
|
||||
assert body["total"] == 2
|
||||
assert {i["name"] for i in body["items"]} == {"Iron", "Iron (Ore)"}
|
||||
|
||||
|
||||
def test_item_detail_commodity():
|
||||
resp = client.get("/api/v1/items/Carryable_TBO_FL_1SCU_Commodity_Metal_Ore_Iron")
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert body["name"] == "Iron (Ore)"
|
||||
assert body["category"] == "commodities"
|
||||
assert body["type"] == "Cargo"
|
||||
assert body["size"] is None
|
||||
assert isinstance(body["details"], dict)
|
||||
|
||||
Reference in New Issue
Block a user