aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2016-06-01 14:30:40 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2016-06-01 14:36:17 +0200
commit74f213834210d6354c57f3c9fe4decf6b9d4b673 (patch)
treeead8c9bf8e08323136653fc6c5bca77b53630520 /testcases
parentd20dd9c32d3154aca1cea723c53eaa7418e0b5c5 (diff)
Check correctly arguments
It fixes argument parsing and verifies all mandatory arguments are provided. It also prevents UnboundLocalError exceptions. Change-Id: Iec3403533b312c95dd453236ccadb1fe495d61cd Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'testcases')
-rw-r--r--testcases/Controllers/ODL/odlreport2db.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/testcases/Controllers/ODL/odlreport2db.py b/testcases/Controllers/ODL/odlreport2db.py
index 50c8b096e..8eb78b19a 100644
--- a/testcases/Controllers/ODL/odlreport2db.py
+++ b/testcases/Controllers/ODL/odlreport2db.py
@@ -33,9 +33,9 @@ import functest.utils.functest_utils as functest_utils
def usage():
print """Usage:
- get-json-from-robot.py --xml=<output.xml> --pod=<pod_name>
- --installer=<installer> --database=<Database URL>
- --scenaro=SCENARIO
+ python odlreport2db.py --xml=<output.xml> --pod=<pod name>
+ --installer=<installer> --database=<database url>
+ --scenario=<scenario>
-x, --xml xml file generated by robot test
-p, --pod POD name where the test come from
-i, --installer
@@ -76,6 +76,7 @@ def parse_suites(suites):
def main(argv):
+ (xml_file, pod, installer, scenario) = None, None, None, None
try:
opts, args = getopt.getopt(argv,
'x:p:i:s:h',
@@ -100,6 +101,9 @@ def main(argv):
else:
usage()
+ if not all(x is not None for x in (xml_file, pod, installer, scenario)):
+ usage()
+
with open(xml_file, "r") as myfile:
xml_input = myfile.read().replace('\n', '')