Skip to content

Commit 364e9cb

Browse files
committed
avoid list order issue
1 parent a1e512b commit 364e9cb

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

tests/routes/test_metadata.py

+18-15
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,26 @@ def test_function_index(app):
3636
body = response.json()
3737
assert len(body) == 3
3838

39-
assert body[0]["id"] == "landsat_poly_centroid"
40-
assert body[0]["function_name"] == "landsat_poly_centroid"
41-
assert body[0]["bounds"]
42-
assert body[0]["tileurl"]
43-
assert "options" not in body[0]
39+
func = list(filter(lambda x: x["id"] == "landsat_poly_centroid", body))[0]
40+
assert func["id"] == "landsat_poly_centroid"
41+
assert func["function_name"] == "landsat_poly_centroid"
42+
assert func["bounds"]
43+
assert func["tileurl"]
44+
assert "options" not in func
4445

45-
assert body[1]["id"] == "squares"
46-
assert body[1]["function_name"] == "squares"
47-
assert body[1]["bounds"]
48-
assert body[1]["tileurl"]
49-
assert "options" not in body[1]
46+
func = list(filter(lambda x: x["id"] == "squares", body))[0]
47+
assert func["id"] == "squares"
48+
assert func["function_name"] == "squares"
49+
assert func["bounds"]
50+
assert func["tileurl"]
51+
assert "options" not in func
5052

51-
assert body[2]["id"] == "squares2"
52-
assert body[2]["function_name"] == "squares"
53-
assert body[2]["bounds"] == [0.0, 0.0, 180.0, 90.0]
54-
assert body[2]["tileurl"]
55-
assert body[2]["options"] == [{"name": "depth", "default": 2}]
53+
func = list(filter(lambda x: x["id"] == "squares2", body))[0]
54+
assert func["id"] == "squares2"
55+
assert func["function_name"] == "squares"
56+
assert func["bounds"] == [0.0, 0.0, 180.0, 90.0]
57+
assert func["tileurl"]
58+
assert func["options"] == [{"name": "depth", "default": 2}]
5659

5760

5861
def test_function_info(app):

0 commit comments

Comments
 (0)