Skip to content

Commit

Permalink
Convert tests to v2, fix them
Browse files Browse the repository at this point in the history
Also add some missing agate methods to stubs
fix tests from splitting the config renderer
  • Loading branch information
Jacob Beck committed Apr 16, 2020
1 parent 35c8f7a commit 7087709
Show file tree
Hide file tree
Showing 69 changed files with 727 additions and 525 deletions.
15 changes: 12 additions & 3 deletions test/integration/001_simple_copy_test/test_simple_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ def project_config(self):

def seed_quote_cfg_with(self, extra):
cfg = {
'config-version': 2,
'seeds': {
'quote_columns': False,
'config': {
'quote_columns': False,
},
}
}
cfg.update(extra)
Expand Down Expand Up @@ -109,7 +112,9 @@ def test__snowflake__simple_copy(self):
self.use_default_project({
"data-paths": [self.dir("seed-initial")],
"seeds": {
'quote_columns': False,
'config': {
'quote_columns': False,
},
}
})
results = self.run_dbt(["seed"])
Expand Down Expand Up @@ -322,7 +327,11 @@ def test__snowflake__incremental_overwrite(self):

# Setting the incremental_strategy should make this succeed
self.use_default_project({
"models": {"incremental_strategy": "delete+insert"},
"models": {
'config': {
"incremental_strategy": "delete+insert"
},
},
"data-paths": [self.dir("snowflake-seed-update")],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ def models(self):
@property
def project_config(self):
return {
'models': {
'vars': {
'config-version': 2,
'vars': {
'test': {
'var_ref': '{{ ref("view_copy") }}',
}
}
},
},
}

def setUp(self):
Expand Down
43 changes: 32 additions & 11 deletions test/integration/004_simple_snapshot_test/test_simple_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TestSimpleSnapshotFiles(BaseSimpleSnapshotTest):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-snapshots-pg'],
'macro-paths': ['macros'],
Expand Down Expand Up @@ -108,11 +109,14 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
'data-paths': ['data'],
'macro-paths': ['custom-snapshot-macros', 'macros'],
'snapshot-paths': ['test-snapshots-checkall'],
'seeds': {
'quote_columns': False,
'config': {
'quote_columns': False,
},
}
}

Expand Down Expand Up @@ -172,6 +176,7 @@ class TestCustomSnapshotFiles(BaseSimpleSnapshotTest):
@property
def project_config(self):
return {
'config-version': 2,
'data-paths': ['data'],
'macro-paths': ['custom-snapshot-macros', 'macros'],
'snapshot-paths': ['test-snapshots-pg-custom'],
Expand Down Expand Up @@ -202,6 +207,7 @@ class TestNamespacedCustomSnapshotFiles(BaseSimpleSnapshotTest):
@property
def project_config(self):
return {
'config-version': 2,
'data-paths': ['data'],
'macro-paths': ['custom-snapshot-macros', 'macros'],
'snapshot-paths': ['test-snapshots-pg-custom-namespaced'],
Expand All @@ -226,6 +232,7 @@ class TestInvalidNamespacedCustomSnapshotFiles(BaseSimpleSnapshotTest):
@property
def project_config(self):
return {
'config-version': 2,
'data-paths': ['data'],
'macro-paths': ['custom-snapshot-macros', 'macros'],
'snapshot-paths': ['test-snapshots-pg-custom-invalid'],
Expand All @@ -251,6 +258,7 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-snapshots-select',
'test-snapshots-pg'],
Expand Down Expand Up @@ -303,15 +311,18 @@ class TestConfiguredSnapshotFileSelects(TestSimpleSnapshotFileSelects):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-snapshots-select-noconfig'],
"snapshots": {
"test": {
"target_schema": self.unique_schema(),
"unique_key": "id || '-' || first_name",
'strategy': 'timestamp',
'updated_at': 'updated_at',
}
"config": {
"target_schema": self.unique_schema(),
"unique_key": "id || '-' || first_name",
'strategy': 'timestamp',
'updated_at': 'updated_at',
},
},
},
'macro-paths': ['macros'],
}
Expand All @@ -329,6 +340,7 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"snapshot-paths": ['test-snapshots-bq'],
'macro-paths': ['macros'],
}
Expand Down Expand Up @@ -413,6 +425,7 @@ def project_config(self):
else:
paths = ['test-snapshots-bq']
return {
'config-version': 2,
'snapshot-paths': paths,
'macro-paths': ['macros'],
}
Expand Down Expand Up @@ -468,6 +481,7 @@ def models(self):
def project_config(self):
paths = ['test-snapshots-pg']
return {
'config-version': 2,
'snapshot-paths': paths,
'macro-paths': ['macros'],
}
Expand Down Expand Up @@ -501,6 +515,7 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"snapshot-paths": ['test-snapshots-invalid'],
'macro-paths': ['macros'],
}
Expand Down Expand Up @@ -530,6 +545,7 @@ def assert_expected(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-check-col-snapshots'],
'macro-paths': ['macros'],
Expand All @@ -540,15 +556,18 @@ class TestConfiguredCheckCols(TestCheckCols):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-check-col-snapshots-noconfig'],
"snapshots": {
"test": {
"target_schema": self.unique_schema(),
"unique_key": "id || '-' || first_name",
"strategy": "check",
"check_cols": ["email"],
}
"config": {
"target_schema": self.unique_schema(),
"unique_key": "id || '-' || first_name",
"strategy": "check",
"check_cols": ["email"],
},
},
},
'macro-paths': ['macros'],
}
Expand All @@ -569,6 +588,7 @@ def assert_expected(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
"snapshot-paths": ['test-check-col-snapshots-bq'],
'macro-paths': ['macros'],
Expand Down Expand Up @@ -644,6 +664,7 @@ def run_snapshot(self):
@property
def project_config(self):
return {
'config-version': 2,
"snapshot-paths": ['test-snapshots-longtext'],
'macro-paths': ['macros'],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"snapshot-paths": ['check-snapshots'],
"test-paths": ['check-snapshots-expected'],
"source-paths": [],
Expand Down
23 changes: 15 additions & 8 deletions test/integration/005_simple_seed_test/test_seed_type_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,29 @@ def schema(self):
@property
def project_config(self):
return {
'config-version': 2,
'data-paths': ['data-config'],
'macro-paths': ['macros'],
'seeds': {
'test': {
'enabled': False,
'config': {
'enabled': False,
'quote_columns': True,
},
'seed_enabled': {
'enabled': True,
'column_types': self.seed_enabled_types()
'config': {
'enabled': True,
'column_types': self.seed_enabled_types()
},
},
'seed_tricky': {
'enabled': True,
'column_types': self.seed_tricky_types(),
}
'config': {
'enabled': True,
'column_types': self.seed_tricky_types(),
},
},
},
'quote_columns': True,
}
},
}


Expand Down
48 changes: 35 additions & 13 deletions test/integration/005_simple_seed_test/test_simple_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
'seeds': {
'quote_columns': False,
'config': {
'quote_columns': False,
},
}
}

Expand Down Expand Up @@ -67,11 +70,14 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data'],
'seeds': {
"schema": "custom_schema",
'quote_columns': False,
}
'config': {
"schema": "custom_schema",
'quote_columns': False,
},
},
}

@use_profile('postgres')
Expand Down Expand Up @@ -115,18 +121,25 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data-config'],
'seeds': {
"test": {
"seed_enabled": {
"enabled": True
'config': {
"enabled": True
},
},
"seed_disabled": {
"enabled": False
'config': {
"enabled": False
},
}
},
'quote_columns': False,
}
'config': {
'quote_columns': False,
},
},
}

@use_profile('postgres')
Expand Down Expand Up @@ -169,10 +182,13 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data-bad'],
'seeds': {
'quote_columns': False,
}
'config': {
'quote_columns': False,
},
},
}

@use_profile('postgres')
Expand Down Expand Up @@ -201,10 +217,13 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data-bom'],
'seeds': {
'quote_columns': False,
}
'config': {
'quote_columns': False,
},
},
}

@use_profile('postgres')
Expand Down Expand Up @@ -232,9 +251,12 @@ def models(self):
@property
def project_config(self):
return {
'config-version': 2,
"data-paths": ['data-unicode'],
'seeds': {
'quote_columns': False,
'config': {
'quote_columns': False,
},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ class TestSimpleDependencyWithSchema(TestSimpleDependency):
@property
def project_config(self):
return {
'config-version': 2,
'macro-paths': ['schema_override_macros'],
'models': {
'schema': 'dbt_test',
'config': {
'schema': 'dbt_test',
},
}
}

Expand Down Expand Up @@ -158,6 +161,7 @@ def models(self):
def project_config(self):
# these hooks should run first, so nothing to drop
return {
'config-version': 2,
'on-run-start': [
"drop table if exists {{ var('test_create_table') }}",
"drop table if exists {{ var('test_create_second_table') }}",
Expand Down
Loading

0 comments on commit 7087709

Please sign in to comment.