From 4bae0fcd69978b27ed7311e2b6cb32437508dc56 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 10 Mar 2017 15:48:59 -0700 Subject: [PATCH] Fix up two tests --- tests/functional/openlp_core/test_init.py | 2 +- tests/functional/openlp_plugins/songs/test_songselect.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core/test_init.py b/tests/functional/openlp_core/test_init.py index 2684b0695..843445c5e 100644 --- a/tests/functional/openlp_core/test_init.py +++ b/tests/functional/openlp_core/test_init.py @@ -24,7 +24,7 @@ import sys from unittest import TestCase from unittest.mock import MagicMock, patch -from openlp.core import parse_options +from openlp.core import OpenLP, parse_options class TestInitFunctions(TestCase): diff --git a/tests/functional/openlp_plugins/songs/test_songselect.py b/tests/functional/openlp_plugins/songs/test_songselect.py index acdf48a3b..b367b7c41 100644 --- a/tests/functional/openlp_plugins/songs/test_songselect.py +++ b/tests/functional/openlp_plugins/songs/test_songselect.py @@ -72,7 +72,9 @@ class TestSongSelectImport(TestCase, TestMixin): mocked_build_opener.return_value = mocked_opener mocked_login_page = MagicMock() mocked_login_page.find.side_effect = [{'value': 'blah'}, None] - MockedBeautifulSoup.return_value = mocked_login_page + mocked_posted_page = MagicMock() + mocked_posted_page.find.return_value = None + MockedBeautifulSoup.side_effect = [mocked_login_page, mocked_posted_page] mock_callback = MagicMock() importer = SongSelectImport(None) @@ -82,6 +84,7 @@ class TestSongSelectImport(TestCase, TestMixin): # THEN: callback was called 3 times, open was called twice, find was called twice, and False was returned self.assertEqual(3, mock_callback.call_count, 'callback should have been called 3 times') self.assertEqual(2, mocked_login_page.find.call_count, 'find should have been called twice') + self.assertEqual(1, mocked_posted_page.find.call_count, 'find should have been called once') self.assertEqual(2, mocked_opener.open.call_count, 'opener should have been called twice') self.assertFalse(result, 'The login method should have returned False')