Skip to content

Commit

Permalink
functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Feb 9, 2024
1 parent f240078 commit e572dbd
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/functional/defer_state/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,40 @@
{% endsnapshot %}
"""


semantic_model_schema_yml = """
models:
- name: view_model
columns:
- name: id
data_tests:
- unique:
severity: error
- not_null
- name: name
semantic_models:
- name: my_sm
model: ref('view_model')
"""

modified_semantic_model_schema_yml = """
models:
- name: view_model
columns:
- name: id
data_tests:
- unique:
severity: error
- not_null
- name: name
semantic_models:
- name: my_sm
model: ref('view_model')
description: modified description
"""

model_1_sql = """
select * from {{ ref('seed') }}
"""
Expand Down Expand Up @@ -422,3 +456,7 @@
config:
group: finance
"""

metricflow_time_spine_sql = """
SELECT to_date('02/20/2023', 'mm/dd/yyyy') as date_day
"""
22 changes: 22 additions & 0 deletions tests/functional/defer_state/test_modified_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
table_model_now_view_sql,
table_model_now_incremental_sql,
view_model_now_table_sql,
metricflow_time_spine_sql,
semantic_model_schema_yml,
modified_semantic_model_schema_yml,
)


Expand Down Expand Up @@ -993,3 +996,22 @@ def test_changed_access(self, project):

results = run_dbt(["list", "-s", "state:modified", "--state", "./state"])
assert results == ["test.table_model.v1", "test.table_model.v2"]


class TestChangedSemanticModelContents(BaseModifiedState):
@pytest.fixture(scope="class")
def models(self):
return {
"view_model.sql": view_model_sql,
"schema.yml": semantic_model_schema_yml,
"metricflow_time_spine.sql": metricflow_time_spine_sql,
}

def test_changed_semantic_model_contents(self, project):
self.run_and_save_state()
results = run_dbt(["list", "-s", "state:modified", "--state", "./state"])
assert len(results) == 0

write_file(modified_semantic_model_schema_yml, "models", "schema.yml")
results = run_dbt(["list", "-s", "state:modified", "--state", "./state"])
assert len(results) == 1

0 comments on commit e572dbd

Please sign in to comment.