def test_delete_zip_file(self):
        with open(self.download_location, "wb") as zf:
            zf.write(self.zip_file.getvalue())

        delete_zip_file(self.download_location)

        self.assertFalse(os.path.exists(self.download_location))
Esempio n. 2
0
    def test_delete_zip_file_error(self, mock_remove, mock_logger):
        e = "Error description"
        mock_remove.side_effect = Exception(e)
        error_message = "Failed to remove zip file {}, error {}".format(self.download_location, e)

        delete_zip_file(self.download_location)
        mock_logger.assert_called_with(error_message)