Skip to content

Commit aa77f4a

Browse files
committed
testing coverage diff
1 parent c0517d4 commit aa77f4a

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/test_config.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,33 @@
1212
file_name = 'test_config.json'
1313

1414

15+
def _assert_config():
16+
assert Config.api_key == conf_dict.get('apiKey')
17+
assert Config.api_url == conf_dict.get('apiEndpoint')
18+
assert Config.products == [conf_dict.get('products')]
19+
20+
21+
def _reset_config():
22+
Config.api_url, Config.api_key, Config.products = None, None, None
23+
24+
1525
def test_init_config_from_json_file():
1626
file_path = os.path.join(os.path.dirname(__file__), file_name)
1727
with open(file_path, 'w') as output:
1828
output.write(json.dumps(conf_dict))
1929

2030
Config(file=file_path)
21-
2231
os.remove(file_path)
2332

24-
assert Config.api_key == conf_dict.get('apiKey')
25-
assert Config.api_url == conf_dict.get('apiEndpoint')
26-
assert Config.products == [conf_dict.get('products')]
33+
_assert_config()
34+
_reset_config()
35+
36+
37+
def test_set_config():
38+
Config(
39+
api_key=conf_dict.get('apiKey'),
40+
api_url=conf_dict.get('apiEndpoint'),
41+
products=conf_dict.get('products'),
42+
)
43+
_assert_config()
44+
_reset_config()

0 commit comments

Comments
 (0)