예제 #1
0
def test_delete_retrieved_downloaded_file_download_directory_none(context):
    context.download_directory = ''
    toolium.utils.download_files.os.remove = mock.Mock(return_value=0)
    toolium.utils.download_files.os.rmdir = mock.Mock(return_value=0)

    delete_retrieved_downloaded_file(context, 'file_name', None)
    toolium.utils.download_files.os.remove.assert_called_once_with(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), 'output',
                     'downloads', 'file_name'))
    toolium.utils.download_files.os.rmdir.assert_not_called()
예제 #2
0
def test_delete_retrieved_downloaded_file_download_directory_file_dwn(context):
    context.download_directory = "download_path"
    toolium.utils.download_files.os.remove = mock.Mock(return_value=0)
    toolium.utils.download_files.os.rmdir = mock.Mock(return_value=0)

    delete_retrieved_downloaded_file(context, 'file_downloaded', None)
    toolium.utils.download_files.os.remove.assert_called_once_with(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), 'output',
                     DOWNLOADS_FOLDER, 'download_path', 'file_downloaded'))
    toolium.utils.download_files.os.rmdir.assert_called_once_with(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), 'output',
                     DOWNLOADS_FOLDER, 'download_path'))