diff --git a/fidesctl/data/sample/system.yml b/fidesctl/data/sample/system.yml index d4b37f7199..5c30532336 100644 --- a/fidesctl/data/sample/system.yml +++ b/fidesctl/data/sample/system.yml @@ -1,6 +1,6 @@ system: - organizationId: 1 - fidesKey: "dataAnalyticSystem" + fidesKey: "dataAnalyticsSystem" name: "Data Analytics System" description: "A system used for analyzing customer behaviour." systemType: "Service" @@ -18,7 +18,7 @@ system: - organizationId: 1 fidesKey: "customerDataSharingSystem" - name: "Customer Data Sharin System" + name: "Customer Data Sharing System" description: "Share data about our users with third-parties." systemType: "Service" privacyDeclarations: diff --git a/fidesctl/src/fidesctl/core/apply.py b/fidesctl/src/fidesctl/core/apply.py index 6dfce2c87b..fbc0237344 100644 --- a/fidesctl/src/fidesctl/core/apply.py +++ b/fidesctl/src/fidesctl/core/apply.py @@ -1,4 +1,5 @@ """This module handles the logic required for applying manifest files to the server.""" +from pprint import pprint from typing import Dict, List, Tuple, Optional, Iterable from deepdiff import DeepDiff @@ -41,12 +42,14 @@ def sort_create_update_unchanged( unchanged_list.append(manifest_object) else: if diff: - print(DeepDiff(server_object, manifest_object)) + print(f"\nUpdated object with fidesKey: {manifest_object.fidesKey}") + pprint(DeepDiff(server_object, manifest_object)) update_list.append(manifest_object) else: if diff: - print(manifest_object) + print(f"\nNew object with fidesKey: {manifest_object.fidesKey}") + pprint(manifest_object) create_list.append(manifest_object) return create_list, update_list, unchanged_list diff --git a/fidesctl/tests/cli/test_cli.py b/fidesctl/tests/cli/test_cli.py index c9cec01f7c..a1ec6f8880 100644 --- a/fidesctl/tests/cli/test_cli.py +++ b/fidesctl/tests/cli/test_cli.py @@ -35,6 +35,24 @@ def test_dry_apply(test_config_path: str, test_cli_runner: CliRunner): assert result.exit_code == 0 +@pytest.mark.integration +def test_diff_apply(test_config_path: str, test_cli_runner: CliRunner): + result = test_cli_runner.invoke( + cli, ["-f", test_config_path, "apply", "data/sample/", "--diff"] + ) + print(result.output) + assert result.exit_code == 0 + + +@pytest.mark.integration +def test_dry_diff_apply(test_config_path: str, test_cli_runner: CliRunner): + result = test_cli_runner.invoke( + cli, ["-f", test_config_path, "apply", "data/sample/", "--dry", "--diff"] + ) + print(result.output) + assert result.exit_code == 0 + + @pytest.mark.integration def test_find(test_config_path: str, test_cli_runner: CliRunner): result = test_cli_runner.invoke(