~suutari-olli/openlp/click-slide-to-go-live-from-blank

« back to all changes in this revision

Viewing changes to tests/functional/openlp_core_lib/test_serviceitem.py

  • Committer: Tim Bentley
  • Date: 2012-12-08 11:27:22 UTC
  • mfrom: (2127 openlp)
  • mto: This revision was merged to the branch mainline in revision 2149.
  • Revision ID: tim.bentley@gmail.com-20121208112722-sy5wud6xz1xsmrty
Head

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
    Package to test the openlp.core.lib package.
3
 
"""
4
 
from unittest import TestCase
5
 
from mock import MagicMock, patch
6
 
from openlp.core.lib import ServiceItem, Renderer
7
 
 
8
 
VERSE = u'The Lord said to {r}Noah{/r}: \n'\
9
 
        'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n'\
10
 
        'The Lord said to {g}Noah{/g}:\n'\
11
 
        'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n'\
12
 
        'Get those children out of the muddy, muddy \n'\
13
 
        '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}'\
14
 
        'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
15
 
FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']
16
 
 
17
 
class TestServiceItem(TestCase):
18
 
 
19
 
    def serviceitem_basic_test(self):
20
 
        """
21
 
        Test the Service Item
22
 
        """
23
 
        with patch(u'openlp.core.lib.Plugin') as mocked_plugin:
24
 
            #GIVEN: A new service item
25
 
            service_item = ServiceItem(mocked_plugin)
26
 
            #true_boolean = True
27
 
            # WHEN:
28
 
            # THEN: We should get back a valid service item
29
 
            #assert isinstance(true_result, bool), u'The result should be a boolean'
30
 
            assert service_item.is_valid is True, u'A valid Service Item'
31
 
            assert service_item.missing_frames() is False, u'No frames loaded yet'
32
 
 
33
 
    def serviceitem_add_text_test(self):
34
 
        """
35
 
        Test the Service Item
36
 
        """
37
 
        with patch(u'openlp.core.lib.Plugin') as mocked_plugin:
38
 
            #GIVEN: A new service item
39
 
            service_item = ServiceItem(mocked_plugin)
40
 
            #true_boolean = True
41
 
            # WHEN: adding text to a service item
42
 
            service_item.add_from_text(VERSE)
43
 
            service_item.raw_footer = FOOTER
44
 
            # THEN: We should get back a valid service item
45
 
            #assert isinstance(true_result, bool), u'The result should be a boolean'
46
 
            assert service_item.is_valid is True, u'A valid Service Item'
47
 
            assert service_item.missing_frames() is True, u'frames loaded '
48
 
 
49
 
            #GIVEN: A service item with text
50
 
            #WHEN: Render called
51
 
            service_item.render(TRUE)
52
 
            #THEN: ?
 
 
b'\\ No newline at end of file'