-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
773d96d
commit 790f6da
Showing
2 changed files
with
25 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
from unittest.mock import Mock | ||
|
||
import dbt.events | ||
|
||
|
||
def test_connections_sets_logs_in_response_to_env_var(monkeypatch): | ||
"""Test that setting the DBT_SNOWFLAKE_CONNECTOR_DEBUG_LOGGING environment variable happens on import""" | ||
log_mock = Mock() | ||
monkeypatch.setattr(dbt.events, "AdapterLogger", Mock(return_value=log_mock)) | ||
os.environ["DBT_SNOWFLAKE_CONNECTOR_DEBUG_LOGGING"] = "true" | ||
import dbt.adapters.snowflake.connections as connections # noqa | ||
|
||
assert log_mock.debug.call_count == 3 | ||
assert log_mock.set_adapter_dependency_log_level.call_count == 3 | ||
|
||
|
||
def test_connections_does_not_set_logs_in_response_to_env_var(monkeypatch): | ||
log_mock = Mock() | ||
monkeypatch.setattr(dbt.events, "AdapterLogger", Mock(return_value=log_mock)) | ||
import dbt.adapters.snowflake.connections as connections # noqa | ||
|
||
assert log_mock.debug.call_count == 0 | ||
assert log_mock.set_adapter_dependency_log_level.call_count == 0 |