blob: 9a0ff524f1113365ef12e958e0307f8c486c9247 (
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
|
#!/usr/bin/python
import sys
import os
import tempfile
import shutil
import unittest
from lvcgui import MVCGui
import datafiles
import devices
data = datafiles.TestData()
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.lvc = MVCGui()
self.lvc.lvc_focus()
print "starting test: ", self.shortDescription()
datadir, testfiles = data.test_data()
self.lvc.browse_for_files(datadir, testfiles)
self.output_dir = tempfile.mkdtemp()
self.lvc.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
"""
lvc = MVCGui()
_, testfiles = data.test_data(many=True)
lvc.start_conversions()
assert lvc.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')
lvc = MVCGui()
lvc.browse_for_files(item_dir, item)
lvc.start_conversions()
lvc.clear_finished_conversions(testfiles)
assert lvc.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')
lvc = MVCGui()
lvc.browse_for_files(item_dir, item)
lvc.start_conversions()
lvc.verify_conversions_finished()
lvc.clear_and_start_over()
assert lvc.verify_file_not_in_list(testfiles[0])
assert lvc.verify_file_not_in_list(item)
def tearDown(self):
self.lvc.lvc_quit()
shutil.rmtree(self.output_dir)
|