Skip to content

Commit d4d4413

Browse files
committed
actually test schema owner
1 parent de806a1 commit d4d4413

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/functional/adapter/test_schema.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24
from dbt.tests.util import run_dbt
35

@@ -17,6 +19,19 @@ def models(self):
1719
def profile_extra_options():
1820
return {"schema_authorization": "{{ env_var('DBT_TEST_USER_1') }}"}
1921

20-
def test_schema_creation(self, project):
21-
res = run_dbt(["run", "-s", "dummy"])
22+
@staticmethod
23+
def _verify_schema_owner(schema_name, owner, project):
24+
get_schema_owner = f"""
25+
select schema_owner from information_schema.schemata where schema_name = '{schema_name}'
26+
"""
27+
result = project.run_sql(get_schema_owner, fetch="one")[0]
28+
assert result == owner
29+
30+
def test_schema_creation(self, project, unique_schema):
31+
res = run_dbt(["run"])
2232
assert len(res) == 1
33+
34+
self._verify_schema_owner(unique_schema, os.getenv("DBT_TEST_USER_1"), project)
35+
self._verify_schema_owner(
36+
unique_schema + "_with_custom_auth", os.getenv("DBT_TEST_USER_1"), project
37+
)

0 commit comments

Comments
 (0)