-
Notifications
You must be signed in to change notification settings - Fork 22
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
6 changed files
with
194 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
msgpack==0.6.1 | ||
msgpack==0.6.2 | ||
python-dateutil==2.7.3 | ||
urllib3>=1.24.1 |
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,66 @@ | ||
import pytest | ||
|
||
from tdclient.util import normalize_connector_config | ||
|
||
|
||
def test_normalize_connector_config(): | ||
config = {"in": {"type": "s3"}} | ||
assert normalize_connector_config(config) == { | ||
"in": {"type": "s3"}, | ||
"out": {}, | ||
"exec": {}, | ||
"filters": [], | ||
} | ||
|
||
|
||
def test_normalize_connector_config_with_expected_keys(): | ||
config = { | ||
"in": {"type": "s3"}, | ||
"out": {"mode": "append"}, | ||
"exec": {"guess_plugins": ["json"]}, | ||
"filters": [{"type": "speedometer"}], | ||
} | ||
assert normalize_connector_config(config) == config | ||
|
||
|
||
def test_nomalize_connector_with_config_key(): | ||
config = { | ||
"config": { | ||
"in": {"type": "s3"}, | ||
"out": {"mode": "append"}, | ||
"exec": {"guess_plugins": ["json"]}, | ||
"filters": [{"type": "speedometer"}], | ||
} | ||
} | ||
assert normalize_connector_config(config) == config["config"] | ||
|
||
|
||
def test_normalize_connector_without_in_key(): | ||
config = {"config": {"type": "s3"}} | ||
|
||
assert normalize_connector_config(config) == { | ||
"in": config["config"], | ||
"out": {}, | ||
"exec": {}, | ||
"filters": [], | ||
} | ||
|
||
|
||
def test_normalize_connector_witout_in_and_config_keys(): | ||
config = {"type": "s3"} | ||
assert normalize_connector_config(config) == { | ||
"in": config, | ||
"out": {}, | ||
"exec": {}, | ||
"filters": [], | ||
} | ||
|
||
|
||
def test_normalize_conector_has_sibling_keys(): | ||
config = { | ||
"config": {"in": {"type": "s3"}}, | ||
"sibling_key": {"out": {"mode": "append"}}, | ||
} | ||
|
||
with pytest.raises(ValueError): | ||
normalize_connector_config(config) |
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