from xtesting.core import testcase
from xtesting.utils import env
+from xtesting.utils import constants
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
"{}?build_tag={}".format(url, env.get('BUILD_TAG')),
headers=testcase.TestCase.headers)
req.raise_for_status()
- Campaign.__logger.debug("data from DB: \n%s", req.json())
+ output = req.json()
+ Campaign.__logger.debug("data from DB: \n%s", output)
+ for i, _ in enumerate(output["results"]):
+ for j, _ in enumerate(
+ output["results"][i]["details"]["links"]):
+ output["results"][i]["details"]["links"][j] = re.sub(
+ "^{}/*".format(os.environ["HTTP_DST_URL"]), '',
+ output["results"][i]["details"]["links"][j])
+ Campaign.__logger.debug("data to archive: \n%s", output)
with open("{}.json".format(env.get('BUILD_TAG')), "w") as dfile:
- json.dump(req.json(), dfile)
+ json.dump(output, dfile)
except Exception: # pylint: disable=broad-except
Campaign.__logger.exception(
"The results cannot be collected from DB")
build_tag = env.get('BUILD_TAG')
assert Campaign.dump_db() == Campaign.EX_OK
assert Campaign.dump_artifacts() == Campaign.EX_OK
- with zipfile.ZipFile('{}.zip'.format(build_tag), 'w') as zfile:
+ with zipfile.ZipFile('{}.zip'.format(build_tag),
+ 'w', zipfile.ZIP_DEFLATED) as zfile:
zfile.write("{}.json".format(build_tag))
for root, _, files in os.walk(build_tag):
for filename in files:
os.makedirs(testcase.TestCase.dir_results)
if env.get('DEBUG').lower() == 'true':
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.debug.ini'))
+ 'xtesting', constants.DEBUG_INI_PATH))
else:
logging.config.fileConfig(pkg_resources.resource_filename(
- 'xtesting', 'ci/logging.ini'))
+ 'xtesting', constants.INI_PATH))
logging.captureWarnings(True)
Campaign.zip_campaign_files()