From a7308fa7b5f14a7e211d063a650fb4c49f7d950f Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Mon, 25 Feb 2019 11:36:37 +0100 Subject: Remove file path hardcodes Make tests runnable in IDE. Change-Id: I9901c10c319687a10616f634fca25297cf84df3a Issue-ID: VNFSDK-375 Signed-off-by: Zebek Bogumil --- tests/packager/test_utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests/packager/test_utils.py') diff --git a/tests/packager/test_utils.py b/tests/packager/test_utils.py index 3124ea5..2a2d98c 100644 --- a/tests/packager/test_utils.py +++ b/tests/packager/test_utils.py @@ -19,6 +19,14 @@ import subprocess import pytest from vnfsdk_pkgtools.packager import utils +from vnfsdk_pkgtools import util + +ROOT_DIR = util.get_project_root() +RESOURCES_DIR= os.path.join(ROOT_DIR, 'tests', 'resources', 'signature') + +MSG_FILE = os.path.join(RESOURCES_DIR, 'manifest.mf') +CERT_FILE = os.path.join(RESOURCES_DIR, 'test.crt') +KEY_FILE = os.path.join(RESOURCES_DIR, 'test.key') CONTENT = "needToBeHashed" SHA256 = "20a480339aa4371099f9503511dcc5a8051ce3884846678ced5611ec64bbfc9c" @@ -38,11 +46,6 @@ def test_cal_file_hash_remote(mocker): mocker.patch('requests.get', new=FakeRequest) assert SHA256 == utils.cal_file_hash("", "http://fake", 'sha256') - -MSG_FILE = "tests/resources/signature/manifest.mf" -CERT_FILE = "tests/resources/signature/test.crt" -KEY_FILE = "tests/resources/signature/test.key" - def test_sign_verify_pairwise(): cms = utils.sign(MSG_FILE, CERT_FILE, KEY_FILE) # We can't examine the exact content of cms because it contains timestamp -- cgit 1.2.3-korg