aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/tests/unit/utils/test_decorators.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-10 12:55:10 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-12 18:32:59 +0200
commit95092b511dbacac412dbe5b8ff3a28abb3d3f664 (patch)
tree24a547cf1a687af0d4db184375abcc03aef998ba /xtesting/tests/unit/utils/test_decorators.py
parenta9491ef0948f8fe3eb3772b6b6ae44d86bde7e9b (diff)
Leverage on abc and stevedore
Change-Id: I7b3c4c0c5dd0c9e6fb3e52c3fff5221d4b831b02 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/tests/unit/utils/test_decorators.py')
-rw-r--r--xtesting/tests/unit/utils/test_decorators.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/xtesting/tests/unit/utils/test_decorators.py b/xtesting/tests/unit/utils/test_decorators.py
index 83b182a8..c08a7ea3 100644
--- a/xtesting/tests/unit/utils/test_decorators.py
+++ b/xtesting/tests/unit/utils/test_decorators.py
@@ -28,6 +28,13 @@ FILE = '{}/null'.format(DIR)
URL = 'file://{}'.format(FILE)
+class FakeTestCase(testcase.TestCase):
+ # pylint: disable=missing-docstring
+
+ def run(self, **kwargs):
+ return testcase.TestCase.EX_OK
+
+
class DecoratorsTesting(unittest.TestCase):
# pylint: disable=missing-docstring
@@ -66,7 +73,7 @@ class DecoratorsTesting(unittest.TestCase):
return json.dumps(data, sort_keys=True)
def _get_testcase(self):
- test = testcase.TestCase(
+ test = FakeTestCase(
project_name=self._project_name, case_name=self._case_name)
test.start_time = self._start_time
test.stop_time = self._stop_time
@@ -74,6 +81,10 @@ class DecoratorsTesting(unittest.TestCase):
test.details = {}
return test
+ def test_run_fake(self):
+ test = self._get_testcase()
+ self.assertEqual(test.run(), testcase.TestCase.EX_OK)
+
@mock.patch('requests.post')
def test_http_shema(self, *args):
os.environ['TEST_DB_URL'] = 'http://127.0.0.1'