-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/pip/snowflake-connector-python-se…
…cure-local-storage--3.12.2
- Loading branch information
Showing
4 changed files
with
109 additions
and
5 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
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,74 @@ | ||
from textwrap import dedent | ||
|
||
import pytest | ||
from snowflake.cli.api.project.definition import load_project | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"override, expected", | ||
[("", ["A", "B", "entity_value"]), ("!override", ["entity_value"])], | ||
) | ||
def test_override_works_for_sequences(named_temporary_file, override, expected): | ||
text = f"""\ | ||
definition_version: "2" | ||
mixins: | ||
mixin_a: | ||
external_access_integrations: | ||
- A | ||
- B | ||
entities: | ||
my_function: | ||
type: "function" | ||
stage: foo_stage | ||
returns: string | ||
handler: foo.baz | ||
signature: "" | ||
artifacts: [] | ||
external_access_integrations: {override} | ||
- entity_value | ||
meta: | ||
use_mixins: ["mixin_a"] | ||
""" | ||
|
||
with named_temporary_file(suffix=".yml") as p: | ||
p.write_text(dedent(text)) | ||
result = load_project([p]) | ||
|
||
pd = result.project_definition | ||
assert pd.entities["my_function"].external_access_integrations == expected | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"override, expected", | ||
[("", {"A": "a", "B": "b", "entity": "value"}), ("!override", {"entity": "value"})], | ||
) | ||
def test_override_works_for_mapping(named_temporary_file, override, expected): | ||
text = f"""\ | ||
definition_version: "2" | ||
mixins: | ||
mixin_a: | ||
secrets: | ||
A: a | ||
mixin_b: | ||
secrets: | ||
B: b | ||
entities: | ||
my_function: | ||
type: "function" | ||
stage: foo_stage | ||
returns: string | ||
handler: foo.baz | ||
signature: "" | ||
artifacts: [] | ||
secrets: {override} | ||
entity: value | ||
meta: | ||
use_mixins: ["mixin_a", "mixin_b"] | ||
""" | ||
|
||
with named_temporary_file(suffix=".yml") as p: | ||
p.write_text(dedent(text)) | ||
result = load_project([p]) | ||
|
||
pd = result.project_definition | ||
assert pd.entities["my_function"].secrets == expected |