Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Apr 22, 2024
1 parent e8bc017 commit 76cff61
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/functional/dependencies/test_dependency_secrets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import pytest

from dbt.tests.util import run_dbt_and_capture
from dbt_common.constants import SECRET_ENV_PREFIX


class TestAllowSecretProfilePackage:
@pytest.fixture(scope="class", autouse=True)
def setUp(self):
os.environ[SECRET_ENV_PREFIX + "FOR_LOGGING"] = "super secret"
yield
del os.environ[SECRET_ENV_PREFIX + "FOR_LOGGING"]

@pytest.fixture(scope="class")
def packages(self):
return {
"packages": [
{
"package": "dbt-labs/dbt_utils{{ log(env_var('DBT_ENV_SECRET_FOR_LOGGING'), info = true) }}",
"version": "1.0.0",
}
]
}

def test_allow_secrets(self, project):
_, log_output = run_dbt_and_capture(["deps"])
# this will not be written to logs or lock file
assert not ("super secret" in log_output)
assert "*****" in log_output
assert not ("DBT_ENV_SECRET_FOR_LOGGING" in log_output)

0 comments on commit 76cff61

Please sign in to comment.