added another formattingtags test

This commit is contained in:
Andreas Preikschat 2013-02-19 08:27:55 +01:00
parent fe11fd9365
commit 718a440b8f

View File

@ -50,7 +50,7 @@ class TestFormattingTags(TestCase):
def get_html_tags_with_user_tags_test(self): def get_html_tags_with_user_tags_test(self):
""" """
Test the FormattingTags class' get_html_tags static method in combination with user tags. FormattingTags class - test the get_html_tags(), add_html_tags() and remove_html_tag() methods.
""" """
with patch(u'openlp.core.lib.translate') as mocked_translate, \ with patch(u'openlp.core.lib.translate') as mocked_translate, \
patch(u'openlp.core.lib.settings') as mocked_settings, \ patch(u'openlp.core.lib.settings') as mocked_settings, \
@ -67,7 +67,7 @@ class TestFormattingTags(TestCase):
# WHEN: Add our tag and get the tags again. # WHEN: Add our tag and get the tags again.
FormattingTags.load_tags() FormattingTags.load_tags()
FormattingTags.add_html_tags([TAG]) FormattingTags.add_html_tags([TAG])
new_tags_list = FormattingTags.get_html_tags() new_tags_list = copy.deepcopy(FormattingTags.get_html_tags())
# THEN: Lists should not be identically. # THEN: Lists should not be identically.
assert old_tags_list != new_tags_list, u'The lists should be different.' assert old_tags_list != new_tags_list, u'The lists should be different.'
@ -76,3 +76,9 @@ class TestFormattingTags(TestCase):
new_tag = new_tags_list.pop() new_tag = new_tags_list.pop()
assert TAG == new_tag, u'Tags should be identically.' assert TAG == new_tag, u'Tags should be identically.'
# WHEN: Remove the new tag with the FormattingTags.remove_html_tag() method.
FormattingTags.remove_html_tag(len(new_tags_list))
# THEN: The lists should now be identically.
assert old_tags_list == FormattingTags.get_html_tags(), u'The lists should be identically.'