Skip to content

Commit b1425ae

Browse files
authored
Merge pull request #359 from dbt-msft/allow-for-more-flexible-testing-with-azure-auth
allow for more flexible local testing with azure auth
2 parents 41f586a + c71c5c1 commit b1425ae

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/conftest.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88

99
def pytest_addoption(parser):
10-
parser.addoption("--profile", action="store", default="user", type=str)
10+
parser.addoption(
11+
"--profile", action="store", default=os.getenv("PROFILE_NAME", "user"), type=str
12+
)
1113

1214

1315
@pytest.fixture(scope="class")
@@ -105,7 +107,7 @@ def _profile_ci_sql_server():
105107

106108

107109
def _profile_user():
108-
return {
110+
profile = {
109111
**_all_profiles_base(),
110112
**{
111113
"host": os.getenv("SQLSERVER_TEST_HOST"),
@@ -116,19 +118,24 @@ def _profile_user():
116118
"trust_cert": bool(os.getenv("SQLSERVER_TEST_TRUST_CERT", "False")),
117119
},
118120
}
121+
return profile
119122

120123

121124
def _profile_user_azure():
122-
return {
125+
profile = {
123126
**_all_profiles_base(),
124127
**{
125128
"host": os.getenv("SQLSERVER_TEST_HOST"),
126-
"authentication": "auto",
129+
"authentication": os.getenv("SQLSERVER_TEST_AUTH", "auto"),
127130
"encrypt": True,
128131
"trust_cert": True,
129132
"database": os.getenv("SQLSERVER_TEST_DBNAME"),
133+
"client_id": os.getenv("SQLSERVER_TEST_CLIENT_ID"),
134+
"client_secret": os.getenv("SQLSERVER_TEST_CLIENT_SECRET"),
135+
"tenant_id": os.getenv("SQLSERVER_TEST_TENANT_ID"),
130136
},
131137
}
138+
return profile
132139

133140

134141
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)