def setUp(self):
        """
        setup app for tests  

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)
    def setUp(self):
        """
        setup app for tests  

        """
        mvc = MVCGui()
        mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data()
        mvc.browse_for_files(datadir, testfiles)
    def test_browse_for_a_file(self):
        """Scenario: Browse for a single file.

        When I browse for a file
        Then the file is added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=False)
        mvc.browse_for_files(datadir, testfiles)
        item = testfiles[0]
        assert mvc.verify_file_in_list(item) 
예제 #4
0
    def test_clear_finished_conversions(self):
        """Feature: Clear a finished conversions.
 
        Given I have converted a file
        When I clear finished conversions
        Then the file is removed
        """
        mvc = MVCGui()
        _, testfiles = data.test_data(many=True)
        mvc.start_conversions()
        assert mvc.clear_finished_conversions(testfiles)
    def test_choose_several_files(self):
        """Scenario: Browse for several files.

        When I browse for several files
        Then the files are added to the list 
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        for t in testfiles:
            assert mvc.verify_file_in_list(t) 
    def test_drag_a_file_to_drop_zone(self):
        """Scenario: Drag a single file to drop zone.

        When I drag a file to the drop zone 
        Then the file is added to the list 
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=False)
        mvc.drag_and_drop_files(datadir, testfiles)
        item = testfiles[0]
        assert mvc.verify_file_in_list(item) 
    def test_drag_and_drop_multiple_files(self):
        """Scenario: Drag multiple files.

        When I drag several files to the drop zone 
        Then the files are added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.drag_and_drop_files(datadir, testfiles)
        for t in testfiles:
            assert mvc.verify_file_in_list(t) 
def test_android_size_output_default():
    """Scenario: the output format and size are defaults when device selected.

    """
    device_list = devices.devices('Android')
    datadir, testfiles = data.test_data(many=True, new=True)
    mvc = MVCGui()
    mvc.mvc_focus()
    mvc.browse_for_files(datadir, testfiles)

    for x in device_list:
        yield device_defaults, x, mvc
예제 #9
0
    def setUp(self):
        """
        Each tests assumes that I there are files that have been converted. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data()
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)
    def setUp(self):
        """
        Each tests assumes that I there are files in the list ready to be converted to some format. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data(many=True)
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)
    def test_send_file_to_itunes(self):
        """Scenario: Send to iTunes.
 
        Given I have "Send to iTunes" checked
        When  I convert the an apple format 
        Then the file is added to my iTunes library
        """
        item = "mp4-0.mp4"
        mvc = MVCGui()
        mvc.choose_device_conversion("iPad")
        mvc.choose_itunes()
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_itunes(item)
예제 #12
0
    def choose_device_then_change_size(self):
        """Scenario: Choose a device, then choose a custom size.

        When  I choose a device 
        And I change size
        Then the selected size is used in the conversion
        """
        mvc = MVCGui()
        _, testfiles = data.test_data()
        item = testfiles[0]
        w = '240'
        h = '180'
        mvc.choose_device_conversion('Galaxy Tab')
        mvc.choose_custom_size(self, 'on', width=w, height=h)
        mvc.start_conversions()
        assert mvc.verify_size(item, width=w, height=h) 
예제 #13
0
    def test_clear_finished_item_with_in_progress(self):
        """Scenario: Clear finished conversions while others are in progress.

        Given I have converted a file
            And I have some conversions in progress
        When I clear finished conversions
        Then the completed files are removed
            And the in-progress conversions remain
        """
        _, testfiles = data.test_data(many=True)
        item = 'slow_conversion.mkv'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc = MVCGui()
        mvc.browse_for_files(item_dir, item)
        mvc.start_conversions()
        mvc.clear_finished_conversions(testfiles)
        assert mvc.verify_converting(item)
    def setUp(self):
        """
        Each tests assumes that I there are files in the list ready to be converted to some format. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data(many=True)
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)
예제 #15
0
class Test_Custom_Settings(unittest.TestCase):
    """Features: users can specify custom format, size and aspect ration.
  
    """
    def setUp(self):
        """
        Each tests assumes that I there are files in the list ready to be converted to some format. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data(many=True)
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)

    def choose_custom_size(self):
        """Scenario: Choose custom size.

        When I enter a custom size option
        Then the conversion uses that setting."""
        mvc = MVCGui()
        _, testfiles = data.test_data()
        item = testfiles[0]
        w = '360'
        h = '180'

        mvc.choose_custom_size(self, 'on', width=w, height=h)
        mvc.mvc.choose_device_conversion('WebM')
        mvc.start_conversions()
        assert mvc.verify_size(item, width=w, height=h)                


    def choose_aspect_ration(self):
        """Scenario: Choose a device, then choose a custom aspect ratio.

        Given  I choose a device option
        When I set the "aspect ratio"
        Then I'm not really sure what will happen
        """
        self.fail('need to know how to test this')

    def choose_device_then_change_size(self):
        """Scenario: Choose a device, then choose a custom size.

        When  I choose a device 
        And I change size
        Then the selected size is used in the conversion
        """
        mvc = MVCGui()
        _, testfiles = data.test_data()
        item = testfiles[0]
        w = '240'
        h = '180'
        mvc.choose_device_conversion('Galaxy Tab')
        mvc.choose_custom_size(self, 'on', width=w, height=h)
        mvc.start_conversions()
        assert mvc.verify_size(item, width=w, height=h) 
    def setUp(self):
        """
        setup app for tests  

        """
        mvc = MVCGui()
        mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data()
        mvc.browse_for_files(datadir, testfiles)
    def test_drag_more_files_to_drop_zone(self):
        """Scenario: Drag additional files to the existing list.

        Given I have files in the list
        When I drag a new file to the drop zone
        Then the new file is added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.drag_and_drop_files(moredatadir, item)
        assert mvc.verify_file_in_list(item) 
    def test_browse_for_more_files_and_add_them(self):
        """Scenario: Choose additional files and add to the existing list.

        Given I have files in the list of files
        When I browse for several new files
        Then the new files are added to the list
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.browse_for_files(moredatadir, item)
        assert mvc.verify_file_in_list(item) 
예제 #19
0
    def choose_custom_size(self):
        """Scenario: Choose custom size.

        When I enter a custom size option
        Then the conversion uses that setting."""
        mvc = MVCGui()
        _, testfiles = data.test_data()
        item = testfiles[0]
        w = '360'
        h = '180'

        mvc.choose_custom_size(self, 'on', width=w, height=h)
        mvc.mvc.choose_device_conversion('WebM')
        mvc.start_conversions()
        assert mvc.verify_size(item, width=w, height=h)                
예제 #20
0
def test_android_size_output_default():
    """Scenario: the output format and size are defaults when device selected.

    """
    device_list = devices.devices('Android')
    datadir, testfiles = data.test_data(many=True, new=True)
    mvc = MVCGui()
    mvc.mvc_focus()
    mvc.browse_for_files(datadir, testfiles)

    for x in device_list:
        yield device_defaults, x, mvc
class Test_Conversions(unittest.TestCase):
    """For any completed conversion
    I want to be able to locate and play the file
    And it should be formatted as I have specified
    """

    def setUp(self):
        """
        Each tests assumes that I there are files in the list ready to be converted to some format. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data(many=True)
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)


    def test_send_file_to_itunes(self):
        """Scenario: Send to iTunes.
 
        Given I have "Send to iTunes" checked
        When  I convert the an apple format 
        Then the file is added to my iTunes library
        """
        item = "mp4-0.mp4"
        mvc = MVCGui()
        mvc.choose_device_conversion("iPad")
        mvc.choose_itunes()
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_itunes(item)
        

    def test_verify_custom_output_directory(self):
        """Scenario: File in specific output location.

        Given I have set the output directory to "directory"
        When I convert a file
        Then the output file is in the specified directory
        """

        custom_output_dir = os.path.join(os.getenv("HOME"),"Desktop")
        item = "mp4-0.mp4"
        mvc.mvcGui()
        mvc.choose_device_conversion("KindleFire")
        mvc.choose_save_location(custom_output_dir)
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_output_dir(self, item, custom_output_dir)

    def test_file_in_default_location(self):
        """Scenario: File in default output location.

        Given I have set the output directory to "default"
        When I convert a file
        Then the output file is in the default directory
        """

        datadir, testfile = data.test_data()
        item = testfile[0]
        mvc.mvcGui()
        mvc.choose_device_conversion("Galaxy Tab")
        mvc.choose_save_location('default')
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_output_dir(self, item, datadir)

    def test_output_file_name_in_default_dir(self):
        """Scenario: Output file name when saved in default (same) directory.
        
        When I convert a file
        Then it is named with the file name (or even better item title) as the base
        And the output container is the extension
        """
        self.fail('I do not know the planned naming convention yet')

    def test_output_file_name_in_custom_dir(self):
        """Scenario: Output file name when saved in default (same) directory.
        
        When I convert a file
        Then it is named with the file name (or even better item title) as the base
        And the output container is the extension
        """
        self.fail('I do not know the planned naminig convention yet')

    def test_output_video_no_upsize(self):
        datadir, testfile = data.test_data()
        item = testfile[0] #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('on')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(datadir, item), width, height)


        """Scenario: Output file video size.

        When I convert a file to "format"
        And Don't Upsize is selected
        Then the output file dimensions are not changed if the input file is smaller than the device
        """
        
	##This test is best covered more completely in unittests to verify that we resize according to device sizes
        item = "mp4-0.mp4" #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('on')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(self.output_dir, item), width, height)



    def test_output_video_upsize(self):
        """Scenario: Output file video size.

        When I convert a file to "format"
        And Don't Upsize is NOT selected
        The the output file dimensions are changed to match the device spec.
        """
        
##This test is best covered more completely in unittests to verify that we resize according to device sizes

        item = "mp4-0.mp4" #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('off')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(self.output_dir, item), width, height)

    def test_completed_conversions_display(self):
        """Scenario: File displays as completed.

        When I convert a file
        Then the file displays as completed
        """
        item = "mp4-0.mp4"
        mvc.mvcGui()
        mvc.choose_device_conversion("Xoom")
        mvc.choose_save_location(custom_output_dir)
        mvc.start_conversions()
        assert mvc.verify_completed(item, 30)


    def test_failed_conversion_display(self):
        """Scenario: File fails conversion.
        When I convert a "file" to "format"
            And the file conversion fails
        Then the file displays as failed.
        """
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc.mvcGui()
        mvc.browse_for_files(item_dir, item)
        mvc.choose_device_conversion("iPhone")
        mvc.start_conversion()
        assert mvc.verify_failed(item)


    def test_ffmpeg_log_output_on_failure(self):
        """Scenario: Show ffmpeg output.

        Given I convert a file
        When I view the ffmpeg output
        Then the ffmpeg output is displayed in a text window
        """
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc.mvcGui()
        mvc.browse_for_files(item_dir, item)
        mvc.choose_device_conversion("iPhone")
        mvc.start_conversion()
        mvc.verify_failed(item)
        assert mvc.show_ffmpeg_output(item)
        

    def tearDown(self):
        shutil.rmtree(self.output_dir)
        self.mvc_quit()
class Test_Conversions(unittest.TestCase):
    """For any completed conversion
    I want to be able to locate and play the file
    And it should be formatted as I have specified
    """
    def setUp(self):
        """
        Each tests assumes that I there are files in the list ready to be converted to some format. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data(many=True)
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)

    def test_send_file_to_itunes(self):
        """Scenario: Send to iTunes.
 
        Given I have "Send to iTunes" checked
        When  I convert the an apple format 
        Then the file is added to my iTunes library
        """
        item = "mp4-0.mp4"
        mvc = MVCGui()
        mvc.choose_device_conversion("iPad")
        mvc.choose_itunes()
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_itunes(item)

    def test_verify_custom_output_directory(self):
        """Scenario: File in specific output location.

        Given I have set the output directory to "directory"
        When I convert a file
        Then the output file is in the specified directory
        """

        custom_output_dir = os.path.join(os.getenv("HOME"), "Desktop")
        item = "mp4-0.mp4"
        mvc.mvcGui()
        mvc.choose_device_conversion("KindleFire")
        mvc.choose_save_location(custom_output_dir)
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_output_dir(self, item, custom_output_dir)

    def test_file_in_default_location(self):
        """Scenario: File in default output location.

        Given I have set the output directory to "default"
        When I convert a file
        Then the output file is in the default directory
        """

        datadir, testfile = data.test_data()
        item = testfile[0]
        mvc.mvcGui()
        mvc.choose_device_conversion("Galaxy Tab")
        mvc.choose_save_location('default')
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_output_dir(self, item, datadir)

    def test_output_file_name_in_default_dir(self):
        """Scenario: Output file name when saved in default (same) directory.
        
        When I convert a file
        Then it is named with the file name (or even better item title) as the base
        And the output container is the extension
        """
        self.fail('I do not know the planned naming convention yet')

    def test_output_file_name_in_custom_dir(self):
        """Scenario: Output file name when saved in default (same) directory.
        
        When I convert a file
        Then it is named with the file name (or even better item title) as the base
        And the output container is the extension
        """
        self.fail('I do not know the planned naminig convention yet')

    def test_output_video_no_upsize(self):
        datadir, testfile = data.test_data()
        item = testfile[
            0]  #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('on')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(datadir, item), width, height)
        """Scenario: Output file video size.

        When I convert a file to "format"
        And Don't Upsize is selected
        Then the output file dimensions are not changed if the input file is smaller than the device
        """

        ##This test is best covered more completely in unittests to verify that we resize according to device sizes
        item = "mp4-0.mp4"  #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('on')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(self.output_dir, item), width,
                               height)

    def test_output_video_upsize(self):
        """Scenario: Output file video size.

        When I convert a file to "format"
        And Don't Upsize is NOT selected
        The the output file dimensions are changed to match the device spec.
        """

        ##This test is best covered more completely in unittests to verify that we resize according to device sizes

        item = "mp4-0.mp4"  #mp4-0.mp4 is smaller than the Apple Universal Setting
        mvc.mvcGui()
        mvc.choose_device_conversion("Apple Universal")
        mvc.choose_dont_upsize('off')
        mvc.start_conversion()
        assert mvc.verify_size(os.path.join(self.output_dir, item), width,
                               height)

    def test_completed_conversions_display(self):
        """Scenario: File displays as completed.

        When I convert a file
        Then the file displays as completed
        """
        item = "mp4-0.mp4"
        mvc.mvcGui()
        mvc.choose_device_conversion("Xoom")
        mvc.choose_save_location(custom_output_dir)
        mvc.start_conversions()
        assert mvc.verify_completed(item, 30)

    def test_failed_conversion_display(self):
        """Scenario: File fails conversion.
        When I convert a "file" to "format"
            And the file conversion fails
        Then the file displays as failed.
        """
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc.mvcGui()
        mvc.browse_for_files(item_dir, item)
        mvc.choose_device_conversion("iPhone")
        mvc.start_conversion()
        assert mvc.verify_failed(item)

    def test_ffmpeg_log_output_on_failure(self):
        """Scenario: Show ffmpeg output.

        Given I convert a file
        When I view the ffmpeg output
        Then the ffmpeg output is displayed in a text window
        """
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc.mvcGui()
        mvc.browse_for_files(item_dir, item)
        mvc.choose_device_conversion("iPhone")
        mvc.start_conversion()
        mvc.verify_failed(item)
        assert mvc.show_ffmpeg_output(item)

    def tearDown(self):
        shutil.rmtree(self.output_dir)
        self.mvc_quit()
    def test_send_file_to_itunes(self):
        """Scenario: Send to iTunes.
 
        Given I have "Send to iTunes" checked
        When  I convert the an apple format 
        Then the file is added to my iTunes library
        """
        item = "mp4-0.mp4"
        mvc = MVCGui()
        mvc.choose_device_conversion("iPad")
        mvc.choose_itunes()
        mvc.start_conversions()
        mvc.verify_completed(item, 30)
        assert mvc.verify_itunes(item)
예제 #24
0
class Test_Clear_Finished_Conversions(unittest.TestCase):
    """Feature: Removed completed conversions from the list.

       When and item has completed or failed convsion
       I want to remove it from the list
    """
    def setUp(self):
        """
        Each tests assumes that I there are files that have been converted. 

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        datadir, testfiles = data.test_data()
        self.mvc.browse_for_files(datadir, testfiles)
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)

    def test_clear_finished_conversions(self):
        """Feature: Clear a finished conversions.
 
        Given I have converted a file
        When I clear finished conversions
        Then the file is removed
        """
        mvc = MVCGui()
        _, testfiles = data.test_data(many=True)
        mvc.start_conversions()
        assert mvc.clear_finished_conversions(testfiles)

    def test_clear_finished_item_with_in_progress(self):
        """Scenario: Clear finished conversions while others are in progress.

        Given I have converted a file
            And I have some conversions in progress
        When I clear finished conversions
        Then the completed files are removed
            And the in-progress conversions remain
        """
        _, testfiles = data.test_data(many=True)
        item = 'slow_conversion.mkv'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc = MVCGui()
        mvc.browse_for_files(item_dir, item)
        mvc.start_conversions()
        mvc.clear_finished_conversions(testfiles)
        assert mvc.verify_converting(item)

    def test_clear_finished_after_conversion_errors(self):
        """Scenario: Clear finished conversions after conversion errors.

           Given I convert several files and 1 that will fail
           When I clear finished conversions
           Then the completed files are removed
             And the failed conversions are removed
        """
        _, testfiles = data.test_data(many=True)
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc = MVCGui()
        mvc.browse_for_files(item_dir, item)
        mvc.start_conversions()
        mvc.verify_conversions_finished()
        mvc.clear_and_start_over()
        assert mvc.verify_file_not_in_list(testfiles[0])
        assert mvc.verify_file_not_in_list(item)

    def tearDown(self):
        self.mvc.mvc_quit()
        shutil.rmtree(self.output_dir)
예제 #25
0
    def test_clear_finished_after_conversion_errors(self):
        """Scenario: Clear finished conversions after conversion errors.

           Given I convert several files and 1 that will fail
           When I clear finished conversions
           Then the completed files are removed
             And the failed conversions are removed
        """
        _, testfiles = data.test_data(many=True)
        item = 'fake_video.mp4'
        item_dir = data.testfile_attr(item, 'testdir')
        mvc = MVCGui()
        mvc.browse_for_files(item_dir, item)
        mvc.start_conversions()
        mvc.verify_conversions_finished()
        mvc.clear_and_start_over()
        assert mvc.verify_file_not_in_list(testfiles[0])
        assert mvc.verify_file_not_in_list(item)
    def test_browse_more_files_while_converting(self):
        """Scenario: Choose additional files and add to list with conversions in progress.

        Given I have files in the list
            And I start conversion
        When I browse for several new files
        Then the new files are added to the list
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        mvc.choose_device_conversion("iPad")
        mvc.start_conversion()

        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.browse_for_files(moredatadir, item)
        assert mvc.verify_file_in_list(item)
        assert mvc.verify_completed(item, 60)
예제 #27
0
def convert_to_format(device_output):
    """Scenario: Test items are converted to the specified format.
    """
    print device_output
    mvc = MVCGui()
    mvc.mvc_focus()
    expected_failures = ['fake_video.mp4']
    datadir, testfiles = data.test_data(many=True, new=True)
    mvc.browse_for_files(datadir, testfiles)
    output_dir = tempfile.mkdtemp()
    mvc.choose_save_location(output_dir)
    mvc.choose_device_conversion("device_output")
    mvc.start_conversions()
    for item in testfiles:
        if item in expected_failures:
            mvc.verify_failed(item, 120)
        else:
            mvc.verify_completed(item, 120)
        mvc.clear_finished_files(item)
    mvc.clear_and_start_over()
class Test_Choose_Files(unittest.TestCase):
    """Add files to the conversion list either via browse or drag-n-drop.

    """

    def setUp(self):
        """
        setup app for tests  

        """
        self.mvc = MVCGui()
        self.mvc.mvc_focus()
        print "starting test: ", self.shortDescription()
        self.output_dir = tempfile.mkdtemp()
        self.mvc.choose_save_location(self.output_dir)



    def test_browse_for_a_file(self):
        """Scenario: Browse for a single file.

        When I browse for a file
        Then the file is added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=False)
        mvc.browse_for_files(datadir, testfiles)
        item = testfiles[0]
        assert mvc.verify_file_in_list(item) 
      



    def test_choose_several_files(self):
        """Scenario: Browse for several files.

        When I browse for several files
        Then the files are added to the list 
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        for t in testfiles:
            assert mvc.verify_file_in_list(t) 

    def skip_test_choose_a_directory_files(self):
        """Scenario: Choose a directory of files.

        When I browse to a directory of files
        Then the files are added to the list
        """

    def test_drag_a_file_to_drop_zone(self):
        """Scenario: Drag a single file to drop zone.

        When I drag a file to the drop zone 
        Then the file is added to the list 
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=False)
        mvc.drag_and_drop_files(datadir, testfiles)
        item = testfiles[0]
        assert mvc.verify_file_in_list(item) 

    def test_drag_and_drop_multiple_files(self):
        """Scenario: Drag multiple files.

        When I drag several files to the drop zone 
        Then the files are added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.drag_and_drop_files(datadir, testfiles)
        for t in testfiles:
            assert mvc.verify_file_in_list(t) 

    def test_drag_more_files_to_drop_zone(self):
        """Scenario: Drag additional files to the existing list.

        Given I have files in the list
        When I drag a new file to the drop zone
        Then the new file is added to the list
        """
        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.drag_and_drop_files(moredatadir, item)
        assert mvc.verify_file_in_list(item) 

    def test_browse_for_more_files_and_add_them(self):
        """Scenario: Choose additional files and add to the existing list.

        Given I have files in the list of files
        When I browse for several new files
        Then the new files are added to the list
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.browse_for_files(moredatadir, item)
        assert mvc.verify_file_in_list(item) 

        
    def test_drag_more_file_while_converting(self):
        """Scenario: Drag additional files to the existing list with conversions in progress.

        Given I have files in the list
            And I start conversion
        When I drag a new file to the drop zone 
        Then the new file is added to the list and is converted
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        mvc.choose_device_conversion("iPad")
        mvc.start_conversion()

        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.drag_and_drop_files(moredatadir, item)
        assert mvc.verify_file_in_list(item)
        assert mvc.verify_completed(item, 60)

    def test_browse_more_files_while_converting(self):
        """Scenario: Choose additional files and add to list with conversions in progress.

        Given I have files in the list
            And I start conversion
        When I browse for several new files
        Then the new files are added to the list
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        mvc.choose_device_conversion("iPad")
        mvc.start_conversion()

        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.browse_for_files(moredatadir, item)
        assert mvc.verify_file_in_list(item)
        assert mvc.verify_completed(item, 60)

    def tearDown(self):
        shutil.rmtree(self.output_dir)
        self.mvc_quit()
def convert_to_format(device_output):
    """Scenario: Test items are converted to the specified format.
    """
    print device_output
    mvc = MVCGui()
    mvc.mvc_focus()
    expected_failures = ['fake_video.mp4']
    datadir, testfiles = data.test_data(many=True, new=True)
    mvc.browse_for_files(datadir, testfiles)
    output_dir = tempfile.mkdtemp()
    mvc.choose_save_location(output_dir)
    mvc.choose_device_conversion("device_output")
    mvc.start_conversions()
    for item in testfiles:
        if item in expected_failures:
            mvc.verify_failed(item, 120)
        else:
            mvc.verify_completed(item, 120)
        mvc.clear_finished_files(item)
    mvc.clear_and_start_over()
    def test_drag_more_file_while_converting(self):
        """Scenario: Drag additional files to the existing list with conversions in progress.

        Given I have files in the list
            And I start conversion
        When I drag a new file to the drop zone 
        Then the new file is added to the list and is converted
        """

        mvc = MVCGui()
        datadir, testfiles = data.test_data(many=True)
        mvc.browse_for_files(datadir, testfiles)
        mvc.choose_device_conversion("iPad")
        mvc.start_conversion()

        moredatadir, moretestfiles = data.test_data(many=False, new=True)
        item = testfiles[0]
        mvc.drag_and_drop_files(moredatadir, item)
        assert mvc.verify_file_in_list(item)
        assert mvc.verify_completed(item, 60)