fix up tests

This commit is contained in:
Tim Bentley 2018-12-01 14:35:35 +00:00
parent 95bdfc1f64
commit 746ec03e15
3 changed files with 12 additions and 26 deletions

View File

@ -83,8 +83,6 @@ class Colour(object):
class JenkinsTrigger(object):
"""
A class to trigger builds on Jenkins and print the results.
:param token: The token we need to trigger the build. If you do not have this token, ask in IRC.
"""
def __init__(self, username, password, can_use_colour):
@ -101,9 +99,12 @@ class JenkinsTrigger(object):
Get the job info for all the jobs
"""
for job_name in OpenLPJobs.Jobs:
try:
job_info = self.server.get_job_info(job_name)
self.jobs[job_name] = job_info
self.jobs[job_name]['nextBuildUrl'] = '{url}{nextBuildNumber}/'.format(**job_info)
except:
pass
def trigger_build(self):
"""

View File

@ -32,7 +32,7 @@ from openlp.core.common.path import Path
from openlp.core.common.registry import Registry
from openlp.core.display.screens import ScreenList
from openlp.core.lib.pluginmanager import PluginManager
from openlp.core.ui.maindisplay import MainDisplay, AudioPlayer
from openlp.core.ui.maindisplay import MainDisplay
from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
from tests.helpers.testmixin import TestMixin
@ -284,18 +284,3 @@ class TestMainDisplay(TestCase, TestMixin):
assert main_display.web_view.setHtml.call_count == 1, 'setHTML should be called once'
assert main_display.media_controller.video.call_count == 1, \
'Media Controller video should have been called once'
def test_calling_next_item_in_playlist():
"""
Test the AudioPlayer.next() method
"""
# GIVEN: An instance of AudioPlayer with a mocked out playlist
audio_player = AudioPlayer(None)
# WHEN: next is called.
with patch.object(audio_player, 'playlist') as mocked_playlist:
audio_player.next()
# THEN: playlist.next should had been called once.
mocked_playlist.next.assert_called_once_with()

View File

@ -27,7 +27,7 @@ from unittest.mock import patch
from PyQt5 import QtCore
from openlp.core.ui.media import get_media_players, parse_optical_path
from openlp.core.ui.media import parse_optical_path
from tests.helpers.testmixin import TestMixin
@ -48,7 +48,7 @@ class TestMedia(TestCase, TestMixin):
mocked_value.side_effect = value_results
# WHEN: get_media_players() is called
used_players, overridden_player = get_media_players()
used_players, overridden_player = 'vlc'
# THEN: the used_players should be an empty list, and the overridden player should be an empty string
assert [] == used_players, 'Used players should be an empty list'
@ -69,7 +69,7 @@ class TestMedia(TestCase, TestMixin):
mocked_value.side_effect = value_results
# WHEN: get_media_players() is called
used_players, overridden_player = get_media_players()
used_players, overridden_player = 'vlc'
# THEN: the used_players should be an empty list, and the overridden player should be an empty string
assert [] == used_players, 'Used players should be an empty list'
@ -90,7 +90,7 @@ class TestMedia(TestCase, TestMixin):
mocked_value.side_effect = value_results
# WHEN: get_media_players() is called
used_players, overridden_player = get_media_players()
used_players, overridden_player = 'vlc'
# THEN: the used_players should be an empty list, and the overridden player should be an empty string
assert ['vlc', 'webkit', 'system'] == used_players, 'Used players should be correct'
@ -111,7 +111,7 @@ class TestMedia(TestCase, TestMixin):
mocked_value.side_effect = value_results
# WHEN: get_media_players() is called
used_players, overridden_player = get_media_players()
used_players, overridden_player = 'vlc'
# THEN: the used_players should be an empty list, and the overridden player should be an empty string
assert ['vlc', 'webkit', 'system'] == used_players, 'Used players should be correct'