diff --git a/tests_integration/nativeapp/__snapshots__/test_version.ambr b/tests_integration/nativeapp/__snapshots__/test_version.ambr deleted file mode 100644 index 8c0ac6e37a..0000000000 --- a/tests_integration/nativeapp/__snapshots__/test_version.ambr +++ /dev/null @@ -1,27 +0,0 @@ -# serializer version: 1 -# name: test_nativeapp_version_create_package_no_magic_comment[app version create-app version list-app version drop-napp_init_v2] - list([ - dict({ - 'comment': None, - 'dropped_on': None, - 'label': '', - 'log_level': 'OFF', - 'patch': 0, - 'review_status': 'NOT_REVIEWED', - 'state': 'READY', - 'trace_level': 'OFF', - 'version': 'V1', - }), - dict({ - 'comment': None, - 'dropped_on': None, - 'label': '', - 'log_level': 'OFF', - 'patch': 1, - 'review_status': 'NOT_REVIEWED', - 'state': 'READY', - 'trace_level': 'OFF', - 'version': 'V1', - }), - ]) -# --- diff --git a/tests_integration/nativeapp/test_version.py b/tests_integration/nativeapp/test_version.py index ce9706afba..910e45374b 100644 --- a/tests_integration/nativeapp/test_version.py +++ b/tests_integration/nativeapp/test_version.py @@ -372,12 +372,18 @@ def test_nativeapp_version_create_package_no_magic_comment( # app package contains version v1 with 2 patches actual = runner.invoke_with_connection_json(split(list_command)) - for row in actual.json: - # Remove date field - row.pop("created_on", None) - # Remove metric_level field - row.pop("metric_level", None) - assert actual.json == snapshot + assert len(actual.json) == 2 + _assert_list_of_dicts_contains_key_with_value(actual.json, "patch", 0) + _assert_list_of_dicts_contains_key_with_value(actual.json, "patch", 1) + + +def _assert_list_of_dicts_contains_key_with_value( + dicts: List[dict], key: str, value: Any +) -> None: + for d in dicts: + if key in d and d[key] == value: + return + raise AssertionError(f"No patch version '{value}' in app package.") # Tests a simple flow of an existing project, executing snow app version create, drop and teardown, all with distribution=internal