-
Notifications
You must be signed in to change notification settings - Fork 67
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
Showing
4 changed files
with
182 additions
and
5 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
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
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,27 @@ | ||
from unittest.mock import patch, mock_open | ||
|
||
from homematicip.configuration.config_io import ConfigIO | ||
|
||
|
||
def test_get_output_format_config_without_existing_config_file(): | ||
with patch("os.path.exists", return_value=False): | ||
output_format_config = ConfigIO.get_output_format_config() | ||
assert output_format_config is not None | ||
|
||
|
||
def test_get_output_format_config_with_existing_config_file(): | ||
format_file_content = r''' | ||
{ | ||
"device_attributes": ["id", "label", "modelType"], | ||
"group_attributes": ["id", "label"], | ||
"functional_channel_attributes": ["id", "label", "functionalChannelType"] | ||
} | ||
''' | ||
mock_data = mock_open(read_data=format_file_content) | ||
with patch("os.path.exists", return_value=True): | ||
with patch("builtins.open", mock_data): | ||
output_format_config = ConfigIO.get_output_format_config() | ||
assert output_format_config is not None | ||
assert output_format_config.device_attributes == ["id", "label", "modelType"] | ||
assert output_format_config.group_attributes == ["id", "label"] | ||
assert output_format_config.functional_channel_attributes == ["id", "label", "functionalChannelType"] |