Skip to content

Commit

Permalink
added test for alternate extensions logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanl-slalom committed Jun 4, 2024
1 parent 9e86e6e commit 749fef1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/modules/pii_scanner/test_pii_scanner_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def pii_scanner_service(
)


@pytest.fixture()
def pii_scanner_service_alternate_extensions(
mock_repo_files_repository: MagicMock, mock_echo: MagicMock
) -> PiiScannerService:
return PiiScannerService(
mock_repo_files_repository, mock_echo, ignored_extensions=["go.mod", "go.sum"]
)


def test_that_pii_scanner_service_finds_potential_pii(
pii_scanner_service: PiiScannerService,
mock_repo_files_repository: MagicMock,
Expand Down Expand Up @@ -130,3 +139,14 @@ def test_that_pii_scanner_prints_when_exceptions_encountered(

mock_echo.print.assert_called_once()
assert "Error PII scanning" in mock_echo.print.call_args.args[0]


def test_that_pii_scanner_accepts_alternate_ignored_extensions(
pii_scanner_service_alternate_extensions: PiiScannerService,
mock_open_fn: MagicMock,
mock_echo: MagicMock,
):
# Assert that both the custom extensions and the standard defaults
# are present in the initialized ignored extensions.
assert "go.mod" in pii_scanner_service_alternate_extensions.ignored_extensions
assert ".jpeg" in pii_scanner_service_alternate_extensions.ignored_extensions

0 comments on commit 749fef1

Please sign in to comment.