Skip to content

Commit

Permalink
clean up further test failures and visualize sort
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDMurphy committed Jul 12, 2022
1 parent b6b0e52 commit c4a8d86
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/fides/docs/language/taxonomy/data_categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The fides key of the organization to which this Data Category belongs.

## Top Level Data Categories

There are three top-level categories:
There are two top-level categories:

| Label | Parent Key | Description |
| --- | --- | --- |
Expand Down
3 changes: 2 additions & 1 deletion src/fidesctl/core/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def hierarchy_figures(
fides_key_dict = {}

# build assets/relationships for figures
for i, category in enumerate(categories):
sorted_categories = sorted(categories, key=lambda i: i[FIDES_KEY_NAME])
for i, category in enumerate(sorted_categories):
# get sunburst labels and parents
labels.append(category[FIDES_KEY_NAME])
parents.append(category[FIDES_PARENT_NAME])
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_populate_referenced_keys_recursively(test_config: FidesctlConfig) -> No
privacy_declarations=[
PrivacyDeclaration(
name="privacy_declaration_1",
data_categories=["account.contact.email"],
data_categories=["user.contact.email"],
data_use="provide.service",
data_qualifier="aggregated.anonymized",
data_subjects=["customer"],
Expand All @@ -128,7 +128,7 @@ def test_populate_referenced_keys_recursively(test_config: FidesctlConfig) -> No
category.fides_key for category in result_taxonomy.data_category
]
assert sorted(populated_categories) == sorted(
["account.contact.email", "account.contact", "account"]
["user.contact.email", "user.contact", "user"]
)

populated_data_uses = [data_use.fides_key for data_use in result_taxonomy.data_use]
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def test_sample_system_taxonomy() -> Generator:
PrivacyDeclaration(
name="privacy_declaration_1",
data_categories=[
"account.contact.email",
"account.contact.name",
"user.contact.email",
"user.contact.name",
],
data_use="provide.service",
data_qualifier="aggregated.anonymized",
Expand Down
26 changes: 13 additions & 13 deletions tests/core/test_visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
def sample_categories_list() -> List:
return [
{
"fides_key": "account",
"fides_key": "user",
"organization_fides_key": "default_organization",
"name": "Account Data",
"description": "Data related to a system account.",
"name": "User Data",
"description": "Data related to a user.",
"parent_key": None,
},
{
"fides_key": "account.contact",
"fides_key": "user.contact",
"organization_fides_key": "default_organization",
"name": "Account Contact Data",
"description": "Contact data related to a system account.",
"parent_key": "account",
"name": "User Contact Data",
"description": "Contact data related to a user.",
"parent_key": "user",
},
{
"fides_key": "account.contact.city",
"fides_key": "user.contact.address",
"organization_fides_key": "default_organization",
"name": "Account City",
"description": "Account's city level address data.",
"parent_key": "account.contact",
"name": "User Address",
"description": "User address data.",
"parent_key": "user.contact",
},
]

Expand All @@ -49,7 +49,7 @@ def test_hierarchy_figures(sample_categories_list: List) -> None:

@pytest.mark.unit
def test_convert_categories_to_nested_dict(sample_categories_list: List) -> None:
expected_conversion: Dict = {"account": {"contact": {"city": {}}}}
expected_conversion: Dict = {"user": {"contact": {"address": {}}}}
assert (
visualize.convert_categories_to_nested_dict(sample_categories_list)
== expected_conversion
Expand All @@ -58,7 +58,7 @@ def test_convert_categories_to_nested_dict(sample_categories_list: List) -> None

@pytest.mark.unit
def test_nested_categories_to_html_list(sample_categories_list: List) -> None:
expected_html_list = "<h2>Fides Data Category Hierarchy</h2>\n <li>account</li>\n <ul>\n <li>contact</li>\n <ul>\n <li>city</li>\n <ul>\n\n </ul>\n </ul>\n </ul>"
expected_html_list = "<h2>Fides Data Category Hierarchy</h2>\n <li>user</li>\n <ul>\n <li>contact</li>\n <ul>\n <li>address</li>\n <ul>\n\n </ul>\n </ul>\n </ul>"
assert (
visualize.nested_categories_to_html_list(
sample_categories_list, resource_type="data_category"
Expand Down
28 changes: 14 additions & 14 deletions tests/data/sample_hierarchy_figures.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
{
"hoverinfo": "skip",
"labels": [
"account",
"account.contact",
"account.contact.city"
"user",
"user.contact",
"user.contact.address"
],
"parents": [
null,
"account",
"account.contact"
"user",
"user.contact"
],
"type": "sunburst"
},
Expand All @@ -33,9 +33,9 @@
"node": {
"color": "blue",
"label": [
"account",
"account.contact",
"account.contact.city"
"user",
"user.contact",
"user.contact.address"
],
"line": {
"color": "black",
Expand All @@ -52,14 +52,14 @@
{
"hoverinfo": "skip",
"labels": [
"account",
"account.contact",
"account.contact.city"
"user",
"user.contact",
"user.contact.address"
],
"parents": [
null,
"account",
"account.contact"
"user",
"user.contact"
],
"type": "icicle",
"visible": false
Expand Down Expand Up @@ -934,4 +934,4 @@
}
]
}
}
}

0 comments on commit c4a8d86

Please sign in to comment.