From 6dcad0d15533f1f0f4176a3d60bd89fd72573649 Mon Sep 17 00:00:00 2001 From: benne238 Date: Mon, 11 Jan 2021 13:54:59 -0500 Subject: [PATCH] basic test for the list of attributes returned in an item --- api/pytest/test_api_tester.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/api/pytest/test_api_tester.py b/api/pytest/test_api_tester.py index a4af3f5..6350ec8 100644 --- a/api/pytest/test_api_tester.py +++ b/api/pytest/test_api_tester.py @@ -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() \ No newline at end of file