aboutsummaryrefslogtreecommitdiffstats
path: root/test/uitests.sikuli/test_remove_files.py
blob: e3e4a06289ab021c3e6f6d2fb760bc3d45ed7aa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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()