-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_config.py
More file actions
executable file
·44 lines (33 loc) · 1012 Bytes
/
test_config.py
File metadata and controls
executable file
·44 lines (33 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
"""
Test {{ cookiecutter.project_slug }}/config.py
"""
import argparse
import logging
import pytest
from {{ cookiecutter.project_slug }} import config
@pytest.mark.unit
def test_get_args_config(mocker):
"""Test get_args_config()"""
mocker.patch(
"argparse.ArgumentParser.parse_args",
return_value=argparse.Namespace(loglevel=30),
autospec=True,
)
# Validate the return type
assert isinstance(config.get_args_config(), dict)
@pytest.mark.unit
def test_setup_logging(mocker):
"""Test setup_logging()"""
mocker.patch(
"argparse.ArgumentParser.parse_args",
return_value=argparse.Namespace(loglevel=30),
autospec=True,
)
# Validate the return type
assert isinstance(config.setup_logging(), logging.Logger)
@pytest.mark.unit
def test_create_arg_parser():
"""Test create_arg_parser()"""
# Validate the return type
assert isinstance(config.create_arg_parser(), argparse.ArgumentParser)