forked from openlp/openlp
Inserted GIVEN-WHEN-THEN comments
This commit is contained in:
parent
25557784c8
commit
be84d53478
@ -138,6 +138,7 @@ class TestServiceItem(TestCase):
|
|||||||
service_item2.set_from_service(line2)
|
service_item2.set_from_service(line2)
|
||||||
|
|
||||||
# THEN: We should get back a valid service item
|
# THEN: We should get back a valid service item
|
||||||
|
|
||||||
# This test is copied from service_item.py, but is changed since to conform to
|
# This test is copied from service_item.py, but is changed since to conform to
|
||||||
# new layout of service item. The layout use in serviceitem_image_2.osd is actually invalid now.
|
# new layout of service item. The layout use in serviceitem_image_2.osd is actually invalid now.
|
||||||
assert service_item.is_valid is True, u'The new service item should be valid'
|
assert service_item.is_valid is True, u'The new service item should be valid'
|
||||||
@ -166,8 +167,7 @@ class TestServiceItem(TestCase):
|
|||||||
Test the Service Item - load a osd to service_item, convert to json,
|
Test the Service Item - load a osd to service_item, convert to json,
|
||||||
load again to service_item and compare the old and new service_item.
|
load again to service_item and compare the old and new service_item.
|
||||||
"""
|
"""
|
||||||
|
# GIVEN: A valid osd (python pickle format) service in file
|
||||||
# Load osd (python pickle format) from file
|
|
||||||
service_file = os.path.join(TEST_PATH, u'serviceitem_osd2osj.osd')
|
service_file = os.path.join(TEST_PATH, u'serviceitem_osd2osj.osd')
|
||||||
osd_service_items = []
|
osd_service_items = []
|
||||||
try:
|
try:
|
||||||
@ -178,9 +178,8 @@ class TestServiceItem(TestCase):
|
|||||||
finally:
|
finally:
|
||||||
open_file.close()
|
open_file.close()
|
||||||
|
|
||||||
# Dump to json format
|
# WHEN: Dumping loaded osd service to json format, and save to file and reloading to service
|
||||||
json_service_content = json.dumps(osd_service_items)
|
json_service_content = json.dumps(osd_service_items)
|
||||||
|
|
||||||
open_file = None
|
open_file = None
|
||||||
open_filename = u''
|
open_filename = u''
|
||||||
try:
|
try:
|
||||||
@ -195,11 +194,10 @@ class TestServiceItem(TestCase):
|
|||||||
finally:
|
finally:
|
||||||
open_file.close()
|
open_file.close()
|
||||||
os.remove(open_filename)
|
os.remove(open_filename)
|
||||||
|
|
||||||
|
|
||||||
# Load from json format
|
|
||||||
osj_service_items = json.loads(json_service_content)
|
osj_service_items = json.loads(json_service_content)
|
||||||
|
|
||||||
|
# THEN: The service loaded from osj (json format) should be the same as the service loaded from the original osd (python pickle format)
|
||||||
|
|
||||||
# Loop over every item and compare the osj with osd version
|
# Loop over every item and compare the osj with osd version
|
||||||
for osd_item, osj_item in zip(osd_service_items, osj_service_items):
|
for osd_item, osj_item in zip(osd_service_items, osj_service_items):
|
||||||
# Create service item objects
|
# Create service item objects
|
||||||
|
Loading…
Reference in New Issue
Block a user