~ubuntuone-hackers/ubuntu-rest-scopes/trunk

« back to all changes in this revision

Viewing changes to src/scopes/tests/test_openlibrary.py

[r=noise] Support no-docs case in the OpenLibrary search.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
        self.maxDiff = None
122
122
        self.assertEqual(response[2], should_res)
123
123
 
 
124
    def test_search_no_authors(self):
 
125
        app = openlibrary.App(CONFIG)
 
126
        with patch.object(app, '_hit_backend') as mock:
 
127
            mock.return_value = json.loads(get_fixture(
 
128
                'openlibrary-search-nodocs.json'))
 
129
            response = list(app.search(query='alice', platform='desktop', limit=5, locale='C'))
 
130
        self.assertEqual(response, [])
 
131
 
124
132
 
125
133
class PreviewTestCase(TestCase):
126
134
    """Tests for the preview function."""