-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HJ-338 added sorting for system.privacy_declarations and a test to ve…
…rify (#5683) Co-authored-by: Jade Wibbels <[email protected]>
- Loading branch information
Showing
5 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from fides.api.db.system import get_system | ||
from fides.api.models.sql_models import PrivacyDeclaration | ||
|
||
|
||
def test_system_privacy_declarations_in_alphabetical_order(db, system): | ||
""" | ||
Ensure that the system privacy declarations are in alphabetical order by name | ||
""" | ||
# Add more privacy declarations to the system | ||
new_privacy_declarations = [ | ||
{ | ||
"data_use": "marketing.advertising.profiling", | ||
"name": "Declaration Name", | ||
"system_id": system.id, | ||
}, | ||
{ | ||
"data_use": "essential", | ||
"name": "Another Declaration Name", | ||
"system_id": system.id, | ||
}, | ||
] | ||
for data in new_privacy_declarations: | ||
PrivacyDeclaration.create(db=db, data=data) | ||
db.commit() | ||
|
||
db.refresh(system) | ||
updated_system = get_system(db, system.fides_key) | ||
|
||
privacy_declarations = updated_system.privacy_declarations | ||
sorted_privacy_declarations = sorted(privacy_declarations, key=lambda x: x.name) | ||
|
||
assert ( | ||
privacy_declarations == sorted_privacy_declarations | ||
), "Privacy declarations are not in alphabetical order by name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters