X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwlaunchpad%2Fplugins%2Frwpkgmgr%2Ftest%2Futest_publisher_dts.py;h=a02e5c665a7c01f38fe9a0a836e06ecfb208e5c8;hb=844bfbb4487d8493b3449418675c9f360e39f2ef;hp=9ec295611d4e4988e2bde8be914002b1291b3a2f;hpb=85a3dc954226041e4db357fa807b1ffdb6953110;p=osm%2FSO.git diff --git a/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py b/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py index 9ec29561..a02e5c66 100755 --- a/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py +++ b/rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py @@ -99,7 +99,7 @@ class TestCase(rift.test.dts.AbstractDTSTest): "package_id": "123", "download_id": str(uuid.uuid4())}) - self.job_handler.on_download_progress(mock_msg) + yield from self.job_handler._dts_publisher(mock_msg) yield from asyncio.sleep(5, loop=self.loop) itr = yield from self.dts.query_read("/download-jobs/job[download-id='{}']".format( @@ -110,12 +110,12 @@ class TestCase(rift.test.dts.AbstractDTSTest): result = yield from fut result = result.result - print (mock_msg) + print ("Mock ", mock_msg) assert result == mock_msg # Modify the msg mock_msg.url = "http://bar/foo" - self.job_handler.on_download_finished(mock_msg) + yield from self.job_handler._dts_publisher(mock_msg) yield from asyncio.sleep(5, loop=self.loop) itr = yield from self.dts.query_read("/download-jobs/job[download-id='{}']".format( @@ -138,17 +138,18 @@ class TestCase(rift.test.dts.AbstractDTSTest): proxy = mock.MagicMock() - url = "http://boson.eng.riftio.com/common/unittests/rift-shell" + url = "http://boson.eng.riftio.com/common/unittests/plantuml.jar" url_downloader = downloader.PackageFileDownloader(url, "1", "/", "VNFD", proxy) download_id = yield from self.job_handler.register_downloader(url_downloader) assert download_id is not None - + + # Waiting for 5 secs to be sure that the file is downloaded yield from asyncio.sleep(5, loop=self.loop) xpath = "/download-jobs/job[download-id='{}']".format( download_id) result = yield from self.read_xpath(xpath) - print (result) + self.log.debug("Test result before complete check - %s", result) assert result.status == "COMPLETED" assert len(self.job_handler.tasks) == 0 @@ -171,14 +172,16 @@ class TestCase(rift.test.dts.AbstractDTSTest): xpath = "/download-jobs/job[download-id='{}']".format( download_id) - yield from asyncio.sleep(3, loop=self.loop) + yield from asyncio.sleep(1, loop=self.loop) result = yield from self.read_xpath(xpath) + self.log.debug("Test result before in_progress check - %s", result) assert result.status == "IN_PROGRESS" yield from self.job_handler.cancel_download(download_id) yield from asyncio.sleep(3, loop=self.loop) result = yield from self.read_xpath(xpath) + self.log.debug("Test result before cancel check - %s", result) assert result.status == "CANCELLED" assert len(self.job_handler.tasks) == 0