Add migration test

This commit is contained in:
Tim Bentley 2013-05-25 06:48:08 +01:00
parent 4b2868b271
commit 6dd070f60e
2 changed files with 118 additions and 1 deletions

View File

@ -210,7 +210,6 @@ class TestServiceItem(TestCase):
# THEN: We should get back a valid service item
assert service_item.is_valid is True, u'The new service item should be valid'
print service_item.get_rendered_frame(0)
assert service_item.get_rendered_frame(0) == test_file, u'The first frame should match the path to the image'
assert service_item.get_frames()[0] == frame_array, u'The return should match frame array1'
assert service_item.get_frame_path(0) == test_file, u'The frame path should match the full path to the image'
@ -268,6 +267,26 @@ class TestServiceItem(TestCase):
assert service_item.is_capable(ItemCapabilities.CanAppend) is True, \
u'This service item should be able to have new items added to it'
def serviceitem_migrate_test_20_22(self):
"""
Test the Service Item - migrating a media only service item from 2.0 to 2.2 format
"""
# GIVEN: A new service item and a mocked add icon function
service_item = ServiceItem(None)
service_item.add_icon = MagicMock()
# WHEN: adding an media from a saved Service and mocked exists
line = self.convert_file_service_item(u'migrate_video_20_22.osd')
with patch('os.path.exists'):
service_item.set_from_service(line, TEST_PATH)
# THEN: We should get back a converted service item
assert service_item.is_valid is True, u'The new service item should be valid'
assert service_item.processor is None, u'The Processor should have been set'
assert service_item.title is None, u'The title should be set to a value'
assert service_item.is_capable(ItemCapabilities.HasDetailedTitleDisplay) is False, \
u'The Capability should have been removed'
def convert_file_service_item(self, name):
service_file = os.path.join(TEST_PATH, name)
try:

View File

@ -0,0 +1,98 @@
(lp1
(dp2
Vserviceitem
p3
(dp4
Vheader
p5
(dp6
Vxml_version
p7
NsVauto_play_slides_loop
p8
I00
sVauto_play_slides_once
p9
I00
sVwill_auto_start
p10
I01
sVtitle
p11
VVLC
p12
sVcapabilities
p13
(lp14
I12
aI16
aI4
aI11
asVtheme
p15
I-1
sVbackground_audio
p16
(lp17
sVicon
p18
V:/plugins/plugin_media.png
p19
sVtype
p20
I3
sVstart_time
p21
I0
sVfrom_plugin
p22
I00
sVmedia_length
p23
I144
sVdata
p24
V
sVtimed_slide_interval
p25
I0
sVaudit
p26
V
sVsearch
p27
V
sVname
p28
Vmedia
p29
sVfooter
p30
(lp31
sVnotes
p32
V
sVplugin
p33
g29
sVtheme_overwritten
p34
I00
sVend_time
p35
I0
ssg24
(lp36
(dp37
Vpath
p38
V/home/tim/Videos/puppets
p39
sVimage
p40
V:/media/slidecontroller_multimedia.png
p41
sg11
VMVI_3405.MOV
p42
sassa.