summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYichen Wang <yicwang@cisco.com>2017-08-15 11:28:53 -0700
committerYichen Wang <yicwang@cisco.com>2017-08-18 01:04:05 -0700
commit5d2becfd9d6398ce9dfd4c83618de42e272ec830 (patch)
treed9039260137b1d9ab57e25eba853220baa7ba9e3 /test
parent4c5e4ba753face81fd73aa3bae1fe3c012e48859 (diff)
[NFVBENCH-7] Return errors when unknown options are passed
1. Return errors when unknown options are passed 2. Fix pep8 warnings Change-Id: I1cbc86de93b4633bbf9bd66c1dc956ff8b3679a6 Signed-off-by: Yichen Wang <yicwang@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_nfvbench.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index be80033..a220703 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -15,6 +15,7 @@
#
from attrdict import AttrDict
+from nfvbench.config import get_err_config
from nfvbench.connection import SSH
from nfvbench.credentials import Credentials
from nfvbench.network import Interface
@@ -638,3 +639,16 @@ def test_no_credentials():
assert False
else:
assert True
+
+def test_config():
+ refcfg = {1: 100, 2: {21: 100, 22: 200}, 3: None}
+ assert(get_err_config({}, refcfg) is None)
+ assert(get_err_config({1: 10}, refcfg) is None)
+ assert(get_err_config({2: {21: 1000}}, refcfg) is None)
+ assert(get_err_config({3: "abc"}, refcfg) is None)
+ # correctly fails
+ assert(get_err_config({4: 0}, refcfg) == {4: 0})
+ assert(get_err_config({2: {0: 1, 1: 2}}, refcfg) == {2: {0: 1}})
+ # invalid value type
+ assert(get_err_config({1: 'abc', 2: {21: 0}}, refcfg) == {1: 'abc'})
+ assert(get_err_config({2: 100, 5: 10}, refcfg) == {2: 100})