Skip to content

Commit

Permalink
fix: handle fides_key containing __
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDMurphy committed Jun 27, 2023
1 parent 10624ae commit 91b467c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/fides/api/task/task_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def extract_key_for_address(self, full_request_id: str) -> str:
of the Dataset or the Collection name.
"""
request_id_dataset, collection = full_request_id.split(":")
dataset = request_id_dataset.split("__")[-1]
number_of_expected_items_to_remove = 2
request_list = request_id_dataset.split("__")
address_list = request_list[number_of_expected_items_to_remove:]
dataset = "__".join(address_list)
return f"{dataset}:{collection}"

def cache_erasure(self, key: str, value: int) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/ops/task/test_task_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_cache_object(self, db, privacy_request, policy, integration_manual_conf
[{"id": 2, "ccn": "111-111-1111-1111", "customer_id": 1}],
)
resources.cache_object(
"access_request__postgres_example:double__underscore__collection",
"access_request__postgres__double__underscore__example:double__underscore__collection",
[{"id": 3, "last_name": "Doe"}],
)
resources.cache_erasure("manual_example:filing-cabinet", 2)
Expand All @@ -28,7 +28,7 @@ def test_cache_object(self, db, privacy_request, policy, integration_manual_conf
{"id": 2, "ccn": "111-111-1111-1111", "customer_id": 1}
],
"postgres_example:customer": [{"id": 1, "last_name": "Doe"}],
"postgres_example:double__underscore__collection": [
"postgres__double__underscore__example:double__underscore__collection": [
{"id": 3, "last_name": "Doe"}
],
}
Expand Down

0 comments on commit 91b467c

Please sign in to comment.