From e32ea5c26c34c76ef6b37b867f9177cfa0883a53 Mon Sep 17 00:00:00 2001 From: Doug Beatty Date: Thu, 24 Oct 2024 11:42:15 -0600 Subject: [PATCH] Functional test when an exposure references a deprecated model --- tests/functional/deprecations/fixtures.py | 17 +++++++++++++++++ .../deprecations/test_deprecations.py | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/tests/functional/deprecations/fixtures.py b/tests/functional/deprecations/fixtures.py index d9ae97603db..85f45d78f47 100644 --- a/tests/functional/deprecations/fixtures.py +++ b/tests/functional/deprecations/fixtures.py @@ -30,6 +30,23 @@ email: something@example.com """ + +deprecated_model_exposure_yaml = """ +version: 2 + +models: + - name: model + deprecation_date: 1999-01-01 00:00:00.00+00:00 + +exposures: + - name: simple_exposure + type: dashboard + depends_on: + - ref('model') + owner: + email: something@example.com +""" + # deprecated test config fixtures data_tests_yaml = """ models: diff --git a/tests/functional/deprecations/test_deprecations.py b/tests/functional/deprecations/test_deprecations.py index 95779338d8a..2cb51935da4 100644 --- a/tests/functional/deprecations/test_deprecations.py +++ b/tests/functional/deprecations/test_deprecations.py @@ -7,6 +7,7 @@ from dbt_common.exceptions import EventCompilationError from tests.functional.deprecations.fixtures import ( bad_name_yaml, + deprecated_model_exposure_yaml, models_trivial__model_sql, ) @@ -99,6 +100,18 @@ def test_package_redirect_fail(self, project): assert expected_msg in exc_str +class TestDeprecatedModelExposure: + @pytest.fixture(scope="class") + def models(self): + return { + "model.sql": models_trivial__model_sql, + "exposure.yml": deprecated_model_exposure_yaml, + } + + def test_exposure_with_deprecated_model(self, project): + run_dbt(["parse"]) + + class TestExposureNameDeprecation: @pytest.fixture(scope="class") def models(self):