generated from dbt-labs/dbt-oss-template
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for invocation context.
- Loading branch information
1 parent
8ac1293
commit 374ce28
Showing
2 changed files
with
20 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from dbt_common.constants import SECRET_ENV_PREFIX | ||
from dbt_common.context import InvocationContext | ||
|
||
def test_invocation_context_env(): | ||
test_env = {"VAR_1": "value1", "VAR_2": "value2"} | ||
ic = InvocationContext(env=test_env) | ||
assert ic.env == test_env | ||
|
||
def test_invocation_context_secrets(): | ||
test_env = { | ||
f"{SECRET_ENV_PREFIX}_VAR_1": "secret1", | ||
f"{SECRET_ENV_PREFIX}VAR_2": "secret2", | ||
f"NON_SECRET": "nonsecret", | ||
f"foo{SECRET_ENV_PREFIX}": "nonsecret", | ||
} | ||
ic = InvocationContext(env=test_env) | ||
assert set(ic.env_secrets) == set(["secret1", "secret2"]) |