Skip to content

Commit

Permalink
Draft Integration test for ref_override
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcruickshank committed Jan 6, 2020
1 parent 43f099b commit 3f763e3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/integration/055_ref_override_test/data/seed_1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a,b
1,2
2,4
3,6
4 changes: 4 additions & 0 deletions test/integration/055_ref_override_test/data/seed_2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a,b
6,2
12,4
18,6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Macro to override ref and always return the same result
{% macro ref(modelname) %} seed_2 {% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select
*
from {{ ref('seed_1') }}
26 changes: 26 additions & 0 deletions test/integration/055_ref_override_test/test_ref_override.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from test.integration.base import DBTIntegrationTest, use_profile


class TestRefOverride(DBTIntegrationTest):
@property
def schema(self):
return "dbt_ref_override_055"

@property
def project_config(self):
return {
'data-paths': ['data'],
"macro-paths": ["macros"],
}

@property
def models(self):
return "models"

@use_profile('postgres')
def test_postgres_ref_override(self):
self.run_dbt(['seed'])
self.run_dbt(['run'])
# We want it to equal seed_2 and not seed_1. If it's
# still pointing at seed_1 then the override hasn't worked.
self.assertTablesEqual('ref_override', 'seed_2')

0 comments on commit 3f763e3

Please sign in to comment.