ensure order of permissions in tests

This commit is contained in:
jasquat 2023-01-24 10:23:47 -05:00
parent 5ed1b2e2da
commit 6371703637
2 changed files with 5 additions and 2 deletions

View File

@ -1160,7 +1160,8 @@ class ProcessInstanceProcessor:
return the_status return the_status
# inspiration from https://github.com/collectiveidea/delayed_job_active_record/blob/master/lib/delayed/backend/active_record.rb # 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: def lock_process_instance(self, lock_prefix: str) -> None:
locked_by = f"{lock_prefix}_{current_app.config['PROCESS_UUID']}" locked_by = f"{lock_prefix}_{current_app.config['PROCESS_UUID']}"
current_time_in_seconds = round(time.time()) current_time_in_seconds = round(time.time())

View File

@ -57,4 +57,6 @@ class TestGetAllPermissions(BaseTest):
] ]
permissions = GetAllPermissions().run(script_attributes_context) 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