import sys import os import tempfile import shutil import unittest from lvcgui import MVCGui import datafiles import devices data = datafiles.TestData() class Test_Remove_Files(unittest.TestCase): """Remove files from the conversion list """ def setUp(self): """ setup app for tests """ lvc = MVCGui() lvc.lvc_focus() print("starting test: ", self.shortDescription()) datadir, testfiles = data.test_data() lvc.browse_for_files(datadir, testfiles) def test_remove_a_file(self): """Scenario: Remove a file from the list of files. Given I have files in the list When I remove it from the list Then it is not in the list """ lvc.lvcGui() _, testfiles = data.test_data(many=False) item = testfiles[0] assert lvc.remove_files(item) def test_remove_all_files(self): """Scenario: Remove all the files from the list. Given I have files in the list When I remove them from the list Then the list of files is empty """ lvc.lvcGui() _, testfiles = data.test_data() assert lvc.remove_files(testfiles) def test_remove_from_list_with_in_progress_conversions(self): """Scenario: Remove a file from the list of files with conversions in progress. Given I have files in the list And I start conversion When I remove it from the list Then it is not in the list """ item = 'slow_conversion.mkv' item_dir = data.testfile_attr(item, 'testdir') lvc.lvcGui() lvc.browse_for_files(item_dir, item) lvc.choose_device_conversion("WebM") lvc.start_conversion() _, origtestfiles = test_data() lvc.remove_files(origtestfiles[1]) assert lvc.verify_file_in_list(item) assert lvc.verify_completed(item, 160) def test_remove_last_queued_file_with_in_progress_conversions(self): """Scenario: Remove the last queued file from the list with conversions in progress. Given I have lots of files files in the list And I start conversion When I remove the queued file from the list Then the in_progress conversions finished. """ item = 'slow_conversion.mkv' item_dir = data.testfile_attr(item, 'testdir') lvc.lvcGui() lvc.browse_for_files(item_dir, item) lvc.choose_device_conversion("Theora") lvc.start_conversion() lvc.remove_queued_conversions() assert lvc.verify_conversions_finished()