def test_repeat_and_raise_on_error(self): service = OrangelogicSearchProvider(self.provider) with HTTMock(auth_ok, search_error): with self.assertRaises(HTTPError): items = service.find({}) with HTTMock(auth_error, search_error): with self.assertRaises(HTTPError): items = service.find({})
def test_find(self): service = OrangelogicSearchProvider(self.provider) with HTTMock(auth_ok, search_ok): items = service.find({}) self.assertEqual(5, len(items)) self.assertEqual(items.count(), 2021650) # test video self.assertEqual('video', items[0]['type']) self.assertEqual({ 'href': 'https://example.com/video.mp4', 'width': 1280, 'height': 720, 'mimetype': 'video/mp4', }, items[0]['renditions']['webHigh']) self.assertEqual({ 'href': 'https://example.com/thumb.jpg', 'width': 341, 'height': 192, 'mimetype': 'image/jpeg', }, items[0]['renditions']['thumbnail']) self.assertEqual({ 'href': 'https://example.com/thumb.jpg', 'width': 341, 'height': 192, 'mimetype': 'image/jpeg', }, items[0]['renditions']['viewImage'])
def test_find(self): service = OrangelogicSearchProvider(self.provider) with HTTMock(auth_ok, search_ok): items = service.find({}) self.assertEqual(5, len(items)) self.assertEqual(items.count(), 2021650) # test video self.assertEqual("video", items[0]["type"]) self.assertEqual( { "href": "https://example.com/video.mp4", "width": 1280, "height": 720, "mimetype": "video/mp4", }, items[0]["renditions"]["webHigh"], ) self.assertEqual( { "href": "https://example.com/thumb.jpg", "width": 341, "height": 192, "mimetype": "image/jpeg", }, items[0]["renditions"]["thumbnail"], ) self.assertEqual( { "href": "https://example.com/thumb.jpg", "width": 341, "height": 192, "mimetype": "image/jpeg", }, items[0]["renditions"]["viewImage"], )