|
| 1 | +""" |
| 2 | +Copyright (c) 2022, Oracle and/or its affiliates. |
| 3 | +Copyright (c) 2020, Vitor Avancini |
| 4 | +
|
| 5 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + you may not use this file except in compliance with the License. |
| 7 | + You may obtain a copy of the License at |
| 8 | +
|
| 9 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + Unless required by applicable law or agreed to in writing, software |
| 12 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + See the License for the specific language governing permissions and |
| 15 | + limitations under the License. |
| 16 | +""" |
| 17 | + |
| 18 | +import pytest |
| 19 | + |
| 20 | +from dbt.tests.adapter.basic.test_generic_tests import BaseGenericTests |
| 21 | +from dbt.tests.adapter.basic.files import ( |
| 22 | + seeds_base_csv, |
| 23 | + base_view_sql, |
| 24 | + base_table_sql, |
| 25 | + schema_base_yml, |
| 26 | +) |
| 27 | + |
| 28 | +generic_test_seed_yml = """ |
| 29 | +version: 2 |
| 30 | +models: |
| 31 | + - name: base |
| 32 | + columns: |
| 33 | + - name: id |
| 34 | + tests: |
| 35 | + - not_null: |
| 36 | + config: |
| 37 | + where: "name = 'Easton'" |
| 38 | +""" |
| 39 | + |
| 40 | +generic_test_view_yml = """ |
| 41 | +version: 2 |
| 42 | +models: |
| 43 | + - name: view_model |
| 44 | + columns: |
| 45 | + - name: id |
| 46 | + tests: |
| 47 | + - not_null: |
| 48 | + config: |
| 49 | + where: "name = 'Easton'" |
| 50 | +""" |
| 51 | + |
| 52 | +generic_test_table_yml = """ |
| 53 | +version: 2 |
| 54 | +models: |
| 55 | + - name: table_model |
| 56 | + columns: |
| 57 | + - name: id |
| 58 | + tests: |
| 59 | + - not_null: |
| 60 | + config: |
| 61 | + where: "name = 'Easton'" |
| 62 | +""" |
| 63 | + |
| 64 | + |
| 65 | +class TestGenericTestsOracle(BaseGenericTests): |
| 66 | + |
| 67 | + @pytest.fixture(scope="class") |
| 68 | + def seeds(self): |
| 69 | + return { |
| 70 | + "base.csv": seeds_base_csv, |
| 71 | + "schema.yml": generic_test_seed_yml, |
| 72 | + } |
| 73 | + |
| 74 | + @pytest.fixture(scope="class") |
| 75 | + def models(self): |
| 76 | + return { |
| 77 | + "view_model.sql": base_view_sql, |
| 78 | + "table_model.sql": base_table_sql, |
| 79 | + "schema.yml": schema_base_yml, |
| 80 | + "schema_view.yml": generic_test_view_yml, |
| 81 | + "schema_table.yml": generic_test_table_yml, |
| 82 | + } |
0 commit comments