Skip to content

Commit

Permalink
Add test for get_prior_knowledge
Browse files Browse the repository at this point in the history
  • Loading branch information
syou6162 committed Sep 17, 2023
1 parent 2a773d9 commit 61fe557
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
40 changes: 40 additions & 0 deletions tests/test_osmosis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from dbt.contracts.graph.manifest import Manifest
from dbt_osmosis.core.osmosis import DbtYamlManager


class TestDbtYamlManager:
def test_get_prior_knowledge(test):
knowledge = {
"myColumn": {
"progenitor": "source.my_model.source.Order",
"generation": "generation_0",
"name": "my_column",
},
"my_column": {
"progenitor": "model.my_model.mart.Order",
"generation": "generation_0",
"name": "my_column",
},
}
assert (
DbtYamlManager.get_prior_knowledge(knowledge, "my_column")["progenitor"]
== "source.my_model.source.Order"
)

def test_get_prior_knowledge_with_camel_case(test):
knowledge = {
"myColumn": {
"progenitor": "model.my_model.dwh.Order",
"generation": "generation_1",
"name": "myColumn",
},
"my_column": {
"progenitor": "model.my_model.mart.Order",
"generation": "generation_0",
"name": "my_column",
},
}
assert (
DbtYamlManager.get_prior_knowledge(knowledge, "my_column")["progenitor"]
== "model.my_model.dwh.Order"
)

0 comments on commit 61fe557

Please sign in to comment.