def download_tool(tool, destination): success = False try: destination = os.path.join(destination, tool.name) success = download_file(tool.url, destination) except Exception as e: logging.warning(str(e) + " " + tool.url) return success
def test_utils_download_file_success(self, mock_urlretrieve): mock_urlretrieve.return_value = "a_return_value" success = utils.download_file("url", "destination") self.assertTrue(success)
def test_utils_download_file(self, mock_urlretrieve): mock_urlretrieve.side_effect = PermissionError("Permission denied") success = utils.download_file("url", "destination") self.assertFalse(success)