From 384308c4a5af0a66ff9e78de17ace94ab7d1d51f Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 9 Nov 2019 14:04:16 +0100 Subject: Print Test API links in console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It adds TEST_DB_EXT_URL to print the right links in case of NAT or SSH port forwardings. Change-Id: If85b00de7325909facc903fba13a3fd59a1e705f Signed-off-by: Cédric Ollivier --- xtesting/core/testcase.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xtesting/core') diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py index cd0a9378..a385651f 100644 --- a/xtesting/core/testcase.py +++ b/xtesting/core/testcase.py @@ -232,8 +232,14 @@ class TestCase(): url, data=json.dumps(data, sort_keys=True), headers=self._headers) req.raise_for_status() - self.__logger.info( - "The results were successfully pushed to DB") + if urllib.parse.urlparse(url).scheme != "file": + res_url = req.json()["href"] + if env.get('TEST_DB_EXT_URL'): + res_url = res_url.replace( + env.get('TEST_DB_URL'), env.get('TEST_DB_EXT_URL')) + self.__logger.info( + "The results were successfully pushed to DB: \n\n%s\n", + res_url) except AssertionError: self.__logger.exception( "Please run test before publishing the results") -- cgit 1.2.3-korg