-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tom Basche
authored and
Tom Basche
committed
Dec 16, 2019
1 parent
627eb9e
commit 916c43e
Showing
3 changed files
with
31 additions
and
3 deletions.
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
Empty file.
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,26 @@ | ||
from unittest.mock import patch | ||
|
||
from doghouse.datadog_client import DatadogClient | ||
|
||
config = { | ||
'app_key': 'test_app_key', | ||
'api_key': 'test_api_key' | ||
} | ||
|
||
|
||
@patch('doghouse.datadog_client.yaml.safe_load', return_value=config) | ||
def test_load_yaml(mocked_yaml): | ||
d = DatadogClient() | ||
mocked_yaml.assert_called() | ||
assert d.api_key == 'test_api_key' | ||
assert d.app_key == 'test_app_key' | ||
|
||
|
||
@patch('doghouse.datadog_client.yaml.dump') | ||
@patch('doghouse.datadog_client.DatadogClient._load_config', return_value=None) | ||
@patch('builtins.input', return_value="api_or_app_key") | ||
@patch('doghouse.datadog_client.DatadogClient.default_config_file', return_value=".") | ||
def test_no_config_file(input_func, load_config, mocked_yaml_create, mocked_file): | ||
d = DatadogClient() | ||
assert d.api_key == 'api_or_app_key' | ||
assert d.app_key == 'api_or_app_key' |