Skip to content

Commit

Permalink
add node to test
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Sep 22, 2023
1 parent daa025c commit e1fb937
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions tests/functional/cli/test_multioption.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,35 @@
select 1 as fun
"""

source_sql = """
schema_sql = """
sources:
- name: my_source
description: "My source"
schema: test_schema
tables:
- name: my_table
- name: my_other_table
exposures:
- name: weekly_jaffle_metrics
label: By the Week
type: dashboard
maturity: high
url: https://bi.tool/dashboards/1
description: >
Did someone say "exponential growth"?
depends_on:
- ref('model_one')
owner:
name: dbt Labs
email: [email protected]
"""


class TestResourceType:
@pytest.fixture(scope="class")
def models(self):
return {"schema.yml": source_sql, "model_one.sql": model_one_sql}
return {"schema.yml": schema_sql, "model_one.sql": model_one_sql}

def test_resource_type_single(self, project):
result = run_dbt(["-q", "ls", "--resource-types", "model"])
Expand All @@ -28,14 +43,34 @@ def test_resource_type_single(self, project):

def test_resource_type_quoted(self, project):
result = run_dbt(["-q", "ls", "--resource-types", "model source"])
assert len(result) == 2
expected_result = {"test.model_one", "source:test.my_source.my_table"}
assert len(result) == 3
expected_result = {
"test.model_one",
"source:test.my_source.my_table",
"source:test.my_source.my_other_table",
}
assert set(result) == expected_result

def test_resource_type_args(self, project):
result = run_dbt(["-q", "ls", "--resource-type", "model", "--resource-type", "source"])
assert len(result) == 2
expected_result = {"test.model_one", "source:test.my_source.my_table"}
result = run_dbt(
[
"-q",
"ls",
"--resource-type",
"model",
"--resource-type",
"source",
"--resource-type",
"exposure",
]
)
assert len(result) == 4
expected_result = {
"test.model_one",
"source:test.my_source.my_table",
"source:test.my_source.my_other_table",
"exposure:test.weekly_jaffle_metrics",
}
assert set(result) == expected_result


Expand Down

0 comments on commit e1fb937

Please sign in to comment.