Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
merlos committed Oct 25, 2024
1 parent 37a8bb8 commit 38de294
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions primero-api/tests/test_primero_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_call_paginated_api(primero_api):
assert data == [{'id': 1}, {'id': 2}, {'id': 3}, {'id': 4}]


def test_remove_record_pii_default(primero_api):
def test_extract_non_pii_default(primero_api):
record_with_pii = {
'name': 'John Doe', # PII
'date_of_birth': '[email protected]', # PII
Expand All @@ -57,10 +57,10 @@ def test_remove_record_pii_default(primero_api):
'enabled': 'non_pii_value'
}

result = primero_api._remove_record_pii(record_with_pii)
result = primero_api._extract_non_pii(record_with_pii)
assert result == result_record_without_pii

def test_remove_record_pii_custom_cols(primero_api):
def test_extract_non_pii_custom_cols(primero_api):
record_with_custom_non_pii = {
'name': 'John Doe', # PII
'date_of_birth': '[email protected]', # PII
Expand All @@ -74,10 +74,10 @@ def test_remove_record_pii_custom_cols(primero_api):
'custom_non_pii': 'custom_value' # Additional non-PII
}

result = primero_api._remove_record_pii(record_with_custom_non_pii, additional_non_pii_cols=['custom_non_pii'])
result = primero_api._extract_non_pii(record_with_custom_non_pii, additional_non_pii_cols=['custom_non_pii'])
assert result == result_record_with_custom_non_pii

def test_remove_record_pii_custom_nonexistent_cols(primero_api):
def test_extract_non_pii_custom_nonexistent_cols(primero_api):

record_with_custom_non_pii = {
'name': 'John Doe', # PII
Expand All @@ -91,10 +91,10 @@ def test_remove_record_pii_custom_nonexistent_cols(primero_api):
'enabled': 'non_pii_value', # Non-PII
}
# the additional_non_pii_cols do not exist and still does not break
result = primero_api._remove_record_pii(record_with_custom_non_pii, additional_non_pii_cols=['nonexistent_col'])
result = primero_api._extract_non_pii(record_with_custom_non_pii, additional_non_pii_cols=['nonexistent_col'])
assert result == result_record_with_custom_nonexistent_pii

def test_remove_record_pii_with_modified_non_pii_cols(primero_api):
def test_extract_non_pii_with_modified_non_pii_cols(primero_api):
record_with_pii = {
'name': 'John Doe', # PII
'date_of_birth': '[email protected]', # PII
Expand All @@ -110,5 +110,5 @@ def test_remove_record_pii_with_modified_non_pii_cols(primero_api):
'date_of_birth': '[email protected]', # PII
'address_current': '123 Main St', # PII
}
result = primero_api._remove_record_pii(record_with_pii)
result = primero_api._extract_non_pii(record_with_pii)
assert result == result_record_without_pii

0 comments on commit 38de294

Please sign in to comment.