forked from openlp/openlp
Fix broken remote searchs
bzr-revno: 2593
This commit is contained in:
commit
3c23336067
@ -272,7 +272,7 @@ window.OpenLP = {
|
|||||||
value[0] = OpenLP.escapeString(value[0])
|
value[0] = OpenLP.escapeString(value[0])
|
||||||
}
|
}
|
||||||
var txt = "";
|
var txt = "";
|
||||||
if (value[2].length > 0) {
|
if (value.length > 2) {
|
||||||
txt = value[1] + " ( " + value[2] + " )";
|
txt = value[1] + " ( " + value[2] + " )";
|
||||||
} else {
|
} else {
|
||||||
txt = value[1];
|
txt = value[1];
|
||||||
|
@ -257,3 +257,22 @@ class TestMediaItem(TestCase, TestMixin):
|
|||||||
|
|
||||||
# THEN: They should not match
|
# THEN: They should not match
|
||||||
self.assertFalse(result, "Authors 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