Skip to content

Commit

Permalink
Fix test_missing_strategy_snapshot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Jun 7, 2024
1 parent 5413c32 commit f3c47f1
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from dbt.exceptions import ParsingError
from dbt.tests.util import run_dbt
from dbt_common.dataclass_schema import ValidationError
from tests.functional.simple_snapshot.fixtures import (
macros__test_no_overlaps_sql,
models__ref_snapshot_sql,
Expand All @@ -10,7 +10,7 @@

snapshots_invalid__snapshot_sql = """
{# make sure to never name this anything with `target_schema` in the name, or the test will be invalid! #}
{% snapshot missing_field_target_underscore_schema %}
{% snapshot snapshot_actual %}
{# missing the mandatory target_schema parameter #}
{{
config(
Expand Down Expand Up @@ -44,7 +44,10 @@ def macros():


def test_missing_strategy(project):
with pytest.raises(ParsingError) as exc:
with pytest.raises(ValidationError) as exc:
run_dbt(["compile"], expect_pass=False)

assert "Snapshots must be configured with a 'strategy'" in str(exc.value)
assert (
"Snapshots must be configured with a 'strategy', 'unique_key', and 'target_schema'"
in str(exc.value)
)

0 comments on commit f3c47f1

Please sign in to comment.