2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

Return data as a list of dict objects

This commit is contained in:
Oliver Walters 2022-05-17 23:47:09 +10:00
parent a44267c306
commit 3488da19b0

View File

@ -242,4 +242,15 @@ class InvenTreeAPITestCase(APITestCase):
if required_rows is not None: if required_rows is not None:
self.assertEqual(len(rows), required_rows) self.assertEqual(len(rows), required_rows)
return (headers, rows) # Return the file data as a list of dict items, based on the headers
data = []
for row in rows:
entry = {}
for idx, col in enumerate(headers):
entry[col] = row[idx]
data.append(entry)
return data