Skip to content

Commit 184ddb6

Browse files
committed
add unit test
Signed-off-by: hwassman <[email protected]>
1 parent fdaa2f3 commit 184ddb6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/test_params.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
parse_cmd_args, checkCAsettings,
33
checkApplicationPort,
44
checkBasicAuthsettings,
5-
checkForInvalidsettings)
5+
checkForInvalidsettings,
6+
checkAPIsettings)
67
from source.__version__ import __version__ as version
78
from nose2.tools.decorators import with_setup
89

@@ -225,3 +226,22 @@ def test_case18():
225226
assert not valid1
226227
assert msg == ''
227228
assert len(msg1) > 1
229+
230+
231+
@with_setup(my_setup)
232+
def test_case19():
233+
z = a.copy()
234+
del z['apiKeyName']
235+
result = merge_defaults_and_args(a, b)
236+
result1 = merge_defaults_and_args(z, b)
237+
assert len(result.keys()) > 0
238+
assert len(result1.keys()) > 0
239+
assert 'apiKeyValue' not in result.keys()
240+
assert 'apiKeyValue' not in result1.keys()
241+
assert 'apiKeyName' not in result1.keys()
242+
valid, msg = checkAPIsettings(result)
243+
valid1, msg1 = checkAPIsettings(result1)
244+
assert not valid
245+
assert not valid1
246+
assert msg == 'Missing mandatory ApiKey settings, quitting'
247+
assert msg1 == 'Missing mandatory ApiKey settings, quitting'

0 commit comments

Comments
 (0)