-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from kgmcquate/develop
Added more tests, test generation functionality, and docs
- Loading branch information
Showing
20 changed files
with
238 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
packages: | ||
- local: ../ | ||
- local: ../ | ||
- package: dbt-labs/dbt_utils | ||
version: 1.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
dbt compile -q \ | ||
--inline "{{ testgen.get_test_suggestions(ref('users'), resource_type='seeds') }}" \ | ||
> seeds/users_test_suggestions.yml | ||
|
||
dbt compile -q \ | ||
--inline "{{ testgen.get_test_suggestions(ref('colnames_with_spaces'), resource_type='seeds', column_config={'quote': true}) }}" \ | ||
> seeds/colnames_with_spaces_test_suggestions.yml |
4 changes: 2 additions & 2 deletions
4
...ation_tests/tests/generate_accepted_values_tests/accepted_values_colnames_with_spaces.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
integration_tests/tests/generate_accepted_values_tests/accepted_values_users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
integration_tests/tests/generate_range_tests/range_colnames_with_spaces.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
integration_tests/tests/generate_uniqueness_tests/uniqueness_colnames_with_spaces.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
|
||
{% set actual_yaml = testgen.to_yaml( | ||
testgen.get_uniqueness_test_suggestions( | ||
ref('colnames_with_spaces'), | ||
composite_key_length = 1, | ||
column_config={'quote': true} | ||
) | ||
) | ||
%} | ||
|
||
{% set expected_yaml %} | ||
models: | ||
- name: colnames_with_spaces | ||
columns: | ||
- name: First Name | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
quote: true | ||
- name: Age (Years) | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
quote: true | ||
- name: Current City | ||
description: Uniqueness test generated by dbt-testgen | ||
tests: | ||
- unique | ||
- not_null | ||
quote: true | ||
{% endset %} | ||
|
||
{{ assert_equal (actual_yaml | trim, expected_yaml | trim) }} |
6 changes: 3 additions & 3 deletions
6
integration_tests/tests/generate_uniqueness_tests/uniqueness_users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 9 additions & 3 deletions
12
integration_tests/tests/test_test_selection/test_selection_users.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% macro to_yaml(the_obj) %} | ||
{{ return(toyaml(fromjson(tojson(the_obj)))) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.