- Added test

This commit is contained in:
Olli Suutari 2016-08-20 22:14:15 +03:00
parent 4f900dbffb
commit 8224e39a2c
2 changed files with 23 additions and 1 deletions

View File

@ -26,11 +26,12 @@ import os
from unittest import TestCase from unittest import TestCase
from PyQt5 import QtWidgets from PyQt5 import QtWidgets, QtGui, QtCore
from openlp.core.ui.mainwindow import MainWindow from openlp.core.ui.mainwindow import MainWindow
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings
from openlp.core.common.registry import Registry from openlp.core.common.registry import Registry
from openlp.core.common import is_win, is_macosx, is_linux
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin

View File

@ -114,6 +114,27 @@ class TestMediaItem(TestCase, TestMixin):
self.assertEqual(self.media_item.search_results, {}) self.assertEqual(self.media_item.search_results, {})
self.assertEqual(self.media_item.second_search_results, {}) self.assertEqual(self.media_item.second_search_results, {})
def test_required_icons(self):
"""
Test that all the required icons are set properly.
"""
# GIVEN: Mocked icons that need to be called.
self.media_item.has_import_icon = MagicMock()
self.media_item.has_new_icon = MagicMock()
self.media_item.has_edit_icon = MagicMock()
self.media_item.has_delete_icon = MagicMock()
self.media_item.add_to_service_item = MagicMock()
# WHEN: self.media_item.required_icons is called
self.media_item.required_icons()
# THEN: On windows it should return True, on other platforms False
self.assertTrue(self.media_item.has_import_icon, 'Check that the icon is as True.')
self.assertFalse(self.media_item.has_new_icon, 'Check that the icon is called as False.')
self.assertTrue(self.media_item.has_edit_icon, 'Check that the icon is called as True.')
self.assertTrue(self.media_item.has_delete_icon, 'Check that the icon is called as True.')
self.assertFalse(self.media_item.add_to_service_item, 'Check that the icon is called as False')
def on_quick_search_button_general_test(self): def on_quick_search_button_general_test(self):
""" """
Test that general things, which should be called on all Quick searches are called. Test that general things, which should be called on all Quick searches are called.