From eddde23de6b133486c6d23a19f9197025a00c459 Mon Sep 17 00:00:00 2001 From: Vincent Danno Date: Mon, 10 May 2021 11:27:15 +0200 Subject: Use constants instead of hard-coding paths Signed-off-by: Vincent Danno Change-Id: I9bef7db7584d6b615ef102d13797914095512733 --- xtesting/tests/unit/core/test_testcase.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'xtesting/tests/unit/core/test_testcase.py') diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py index 63bfc3fe..990883c6 100644 --- a/xtesting/tests/unit/core/test_testcase.py +++ b/xtesting/tests/unit/core/test_testcase.py @@ -22,6 +22,7 @@ import mock import requests from xtesting.core import testcase +from xtesting.utils import constants __author__ = "Cedric Ollivier " @@ -400,19 +401,21 @@ class TestCaseTesting(unittest.TestCase): mock.call().meta.client.head_bucket(Bucket='xtesting'), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/xtesting.log', - 'prefix/xtesting.log', + constants.LOG_PATH, + os.path.join('prefix', os.path.basename(constants.LOG_PATH)), Config=mock.ANY, ExtraArgs={'ContentType': 'application/octet-stream'}), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/xtesting.debug.log', - 'prefix/xtesting.debug.log', + constants.DEBUG_LOG_PATH, + os.path.join('prefix', + os.path.basename(constants.DEBUG_LOG_PATH)), Config=mock.ANY, ExtraArgs={'ContentType': 'application/octet-stream'}), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/bar', 'prefix/bar', + os.path.join(constants.RESULTS_DIR, 'bar'), + 'prefix/bar', Config=mock.ANY, ExtraArgs={'ContentType': 'application/octet-stream'})] self.assertEqual(args[1].mock_calls, expected) @@ -432,19 +435,21 @@ class TestCaseTesting(unittest.TestCase): mock.call().meta.client.head_bucket(Bucket='xtesting'), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/xtesting.log', - 'prefix/xtesting.log', + constants.LOG_PATH, + os.path.join('prefix', os.path.basename(constants.LOG_PATH)), Config=mock.ANY, ExtraArgs={'ContentType': 'text/plain'}), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/xtesting.debug.log', - 'prefix/xtesting.debug.log', + constants.DEBUG_LOG_PATH, + os.path.join('prefix', + os.path.basename(constants.DEBUG_LOG_PATH)), Config=mock.ANY, ExtraArgs={'ContentType': 'text/plain'}), mock.call().Bucket('xtesting'), mock.call().Bucket().upload_file( - '/var/lib/xtesting/results/bar', 'prefix/bar', + os.path.join(constants.RESULTS_DIR, 'bar'), + 'prefix/bar', Config=mock.ANY, ExtraArgs={'ContentType': 'text/plain'})] self.assertEqual(args[1].mock_calls, expected) -- cgit 1.2.3-korg