feat(api_client): load config using shared helpers
This commit is contained in:
parent
ba0897a023
commit
d42615eb6a
9 changed files with 88 additions and 179 deletions
|
@ -1,5 +1,4 @@
|
|||
import datetime
|
||||
from configparser import ConfigParser
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -16,37 +15,6 @@ def test_time_in_milliseconds():
|
|||
assert utils.time_in_milliseconds(time) == 500
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected",
|
||||
[({}, "http"), ({"base_port": 80}, "http"), ({"base_port": 443}, "https")],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"use_config",
|
||||
[False, True],
|
||||
)
|
||||
def test_get_protocol(payload, use_config, expected):
|
||||
config = ConfigParser() if use_config else {}
|
||||
config["general"] = {**payload}
|
||||
|
||||
assert utils.get_protocol(config) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("payload", [{}, {"base_port": 80}])
|
||||
@pytest.mark.parametrize("use_config", [False, True])
|
||||
@pytest.mark.parametrize(
|
||||
"values, expected",
|
||||
[
|
||||
(["yes", "Yes", "True", "true", True], "https"),
|
||||
(["no", "No", "False", "false", False], "http"),
|
||||
],
|
||||
)
|
||||
def test_get_protocol_force_https(payload, use_config, values, expected):
|
||||
for value in values:
|
||||
config = ConfigParser() if use_config else {}
|
||||
config["general"] = {**payload, "force_ssl": value}
|
||||
assert utils.get_protocol(config) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload, expected",
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue