From 158df8f73cb2988031cd408939681d3ade443b2f Mon Sep 17 00:00:00 2001 From: DR695H Date: Sat, 4 May 2019 15:51:36 -0400 Subject: fix vcpeutils removed relative imports and using the preferred method of importing. use the open instead of file method to get files use the new pyaml method that specifies the loader use builtins.basestring for unicode and nonunicode comparison use the correct method to call the robot framework logger warn adding in unit tests for things to make sure they work Change-Id: I15da74ff66988ef2610ada3ae21a1c6104c26c35 Issue-ID: INT-1061 Signed-off-by: DR695H --- robotframework-onap/tests/__init__.py | 0 robotframework-onap/tests/runner.py | 16 ++++++++++++++++ robotframework-onap/tests/vcpeutils/SoUtils_test.py | 14 ++++++++++++++ robotframework-onap/tests/vcpeutils/__init__.py | 0 4 files changed, 30 insertions(+) create mode 100644 robotframework-onap/tests/__init__.py create mode 100644 robotframework-onap/tests/runner.py create mode 100644 robotframework-onap/tests/vcpeutils/SoUtils_test.py create mode 100644 robotframework-onap/tests/vcpeutils/__init__.py (limited to 'robotframework-onap/tests') diff --git a/robotframework-onap/tests/__init__.py b/robotframework-onap/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/robotframework-onap/tests/runner.py b/robotframework-onap/tests/runner.py new file mode 100644 index 0000000..b58215a --- /dev/null +++ b/robotframework-onap/tests/runner.py @@ -0,0 +1,16 @@ +import unittest + +# import your test modules +from tests.vcpeutils.SoUtils_test import * + + +# initialize the test suite +loader = unittest.TestLoader() +suite = unittest.TestSuite() + +# add tests to the test suite +suite.addTests(loader.loadTestsFromTestCase(SoUtilsTest)) + +# initialize a runner, pass it your suite and run it +runner = unittest.TextTestRunner(verbosity=3) +result = runner.run(suite) diff --git a/robotframework-onap/tests/vcpeutils/SoUtils_test.py b/robotframework-onap/tests/vcpeutils/SoUtils_test.py new file mode 100644 index 0000000..22afed6 --- /dev/null +++ b/robotframework-onap/tests/vcpeutils/SoUtils_test.py @@ -0,0 +1,14 @@ +from unittest import TestCase + + +from vcpeutils.SoUtils import * + + +class SoUtilsTest(TestCase): + + def test(self): + input_dict = dict() + SoUtils.add_related_instance(input_dict, "test", "test2") + results = dict() + results['relatedInstanceList'] = [{"relatedInstance": {"instanceId": "test", "modelInfo": "test2"}}] + self.assertDictContainsSubset(results, input_dict) diff --git a/robotframework-onap/tests/vcpeutils/__init__.py b/robotframework-onap/tests/vcpeutils/__init__.py new file mode 100644 index 0000000..e69de29 -- cgit 1.2.3-korg