forked from openlp/openlp
add tests
This commit is contained in:
parent
2bbdf51aca
commit
8df7c3a9ea
@ -272,7 +272,7 @@ window.OpenLP = {
|
||||
value[0] = OpenLP.escapeString(value[0])
|
||||
}
|
||||
var txt = "";
|
||||
if (value.length > 2 && value[2].length > 0) {
|
||||
if (value.length > 2) {
|
||||
txt = value[1] + " ( " + value[2] + " )";
|
||||
} else {
|
||||
txt = value[1];
|
||||
|
@ -257,3 +257,22 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
|
||||
# THEN: They should not match
|
||||
self.assertFalse(result, "Authors should not match")
|
||||
|
||||
def build_remote_search_test(self):
|
||||
"""
|
||||
Test results for the remote search api
|
||||
"""
|
||||
# GIVEN: A Song and a search a JSON array should be returned.
|
||||
mock_song = MagicMock()
|
||||
mock_song.id = 123
|
||||
mock_song.title = 'My Song'
|
||||
mock_song.search_title = 'My Song'
|
||||
mock_song.alternate_title = 'My alternative'
|
||||
self.media_item.search_entire = MagicMock()
|
||||
self.media_item.search_entire.return_value = [mock_song]
|
||||
|
||||
# WHEN: I process a search
|
||||
search_results = self.media_item.search('My Song', False)
|
||||
|
||||
# THEN: The correct formatted results are returned
|
||||
self.assertEqual(search_results, [[123, 'My Song', 'My alternative']])
|
||||
|
Loading…
Reference in New Issue
Block a user