Skip to content

Commit 14d4760

Browse files
committed
update unit tests to reflect updated api behavior
1 parent f4d8942 commit 14d4760

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tests/resources_api_unit_tests.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ def test_get_resources_by_batch_not_found_partial(self):
107107
f"{self.base_url}/resources/find-resources-in-batch?{query_string}"
108108
)
109109
response = requests.get(url)
110-
self.assertEqual(response.status_code, 404)
110+
self.assertEqual(response.status_code, 200)
111111
data = response.json()
112-
self.assertIn("error", data)
113-
self.assertIn("non-existent", data["error"])
112+
self.assertIsInstance(data, list)
113+
self.assertEqual(len(data), 1)
114+
115+
found_ids = [r["id"] for r in data]
116+
self.assertEqual(len(found_ids), 1)
117+
self.assertEqual("arm-hello64-static", found_ids[0])
114118

115119
def test_get_resources_by_batch_not_found_all(self):
116120
"""Test batch retrieval where all resources are missing."""
@@ -128,7 +132,10 @@ def test_get_resources_by_batch_not_found_all(self):
128132
f"{self.base_url}/resources/find-resources-in-batch?{query_string}"
129133
)
130134
response = requests.get(url)
131-
self.assertEqual(response.status_code, 404)
135+
self.assertEqual(response.status_code, 200)
136+
data = response.json()
137+
self.assertIsInstance(data, list)
138+
self.assertEqual(len(data), 0)
132139

133140
def test_get_resources_by_batch_mismatched_parameters(self):
134141
"""Test batch retrieval with mismatched number of id and version
@@ -173,10 +180,14 @@ def test_get_resources_by_batch_valid_id_invalid_version(self):
173180
f"{self.base_url}/resources/find-resources-in-batch?{query_string}"
174181
)
175182
response = requests.get(url)
176-
self.assertEqual(response.status_code, 404)
183+
self.assertEqual(response.status_code, 200)
177184
data = response.json()
178-
self.assertIn("error", data)
179-
self.assertIn("riscv-ubuntu-20.04-boot", data["error"])
185+
self.assertIsInstance(data, list)
186+
self.assertEqual(len(data), 1)
187+
188+
found_ids = [r["id"] for r in data]
189+
self.assertEqual(len(found_ids), 1)
190+
self.assertEqual("arm-hello64-static", found_ids[0])
180191

181192
# FILTER ENDPOINT TESTS
182193
def test_get_filters(self):

0 commit comments

Comments
 (0)