It was my initial thought but I failed to set up the test within a reasonable
Iv'e managed to increase the coverage by your instructions, thank you.
> your test 'test_on_lock_button_toggled_search_tab' is only really testing the
> last two lines of on_lock_button_toggled
> As, you've gone to all the trouble of setting this test up it would be easy to
> test the if condition which sets the appropriate icon. In your current test
> # GIVEN:
> self.media_item.lock_icon = 'lock icon'
> sender_instance_mock = MagicMock()
> self.media_item.sender = MagicMock(return_value=sender_instance_mock)
> # THEN:
> sender_instance_mock.setIcon.assert_called_once_with('lock icon')
> Then you can just copy and paste your test, make a few modifications calling
> self.media_item.on_lock_button_toggled with False and you've provided 100%
> coverage for the on_lock_button_toggled method, for not too much extra effort.
> See also my inline comment for one small issue with your current test.
Your team OpenLP Core is subscribed to branch lp:openlp.
Mailing list: https://launchpad.net/~openlp-core
Post to : email@example.com
Unsubscribe : https://launchpad.net/~openlp-core
More help : https://help.launchpad.net/ListHelp