Skip to content

Commit

Permalink
basic test for the list of attributes returned in an item
Browse files Browse the repository at this point in the history
  • Loading branch information
benne238 committed Jan 11, 2021
1 parent 46807e9 commit 6dcad0d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions api/pytest/test_api_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,15 @@ def test_ECNQueue_Item():
"department",
"building",
"dateReceived",
"jsonData"
"jsonData",
"toJson"
]

# Returns a list of all attributes in the item object
returnedItemKeys = item.__dict__
# Returns a list of all attributes in the item object, omiting attribute names starting with "_"
returnedItemKeys = []
for attribute in item.__dir__():
if not attribute.startswith("_"):
returnedItemKeys.append(attribute)

# Checks that all necessary keys are in the item
# Checks that all necessary keys are in the item by comparing it to the itemkeys list
assert all(keys in itemKeys for keys in returnedItemKeys)

print()

if __name__ == "__main__":
test_ECNQueue_Item()

0 comments on commit 6dcad0d

Please sign in to comment.