From 637170363778bf10301901612cb08aa2f6fef40e Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 24 Jan 2023 10:23:47 -0500 Subject: [PATCH] ensure order of permissions in tests --- .../services/process_instance_processor.py | 3 ++- .../spiffworkflow_backend/scripts/test_get_all_permissions.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py index 3bc7bffed..ec9fa5b16 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_processor.py @@ -1160,7 +1160,8 @@ class ProcessInstanceProcessor: return the_status # inspiration from https://github.com/collectiveidea/delayed_job_active_record/blob/master/lib/delayed/backend/active_record.rb - # could consider borrowing their "cleanup all my locks when the app quits" idea as well and implement via https://docs.python.org/3/library/atexit.html + # could consider borrowing their "cleanup all my locks when the app quits" idea as well and + # implement via https://docs.python.org/3/library/atexit.html def lock_process_instance(self, lock_prefix: str) -> None: locked_by = f"{lock_prefix}_{current_app.config['PROCESS_UUID']}" current_time_in_seconds = round(time.time()) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_all_permissions.py b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_all_permissions.py index cbf625168..667a6f73a 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_all_permissions.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/scripts/test_get_all_permissions.py @@ -57,4 +57,6 @@ class TestGetAllPermissions(BaseTest): ] permissions = GetAllPermissions().run(script_attributes_context) - assert permissions == expected_permissions + sorted_permissions = sorted(permissions, key=lambda x: x['uri'] or '') + sorted_expected_permissions = sorted(expected_permissions, key=lambda x: x['uri'] or '') + assert sorted_permissions == sorted_expected_permissions