mirror of https://github.com/searxng/searxng.git
better test data
This commit is contained in:
parent
3034c85163
commit
baf16b8869
|
@ -20,28 +20,30 @@ class TestFrinkiacEngine(SearxTestCase):
|
||||||
self.assertRaises(AttributeError, frinkiac.response, '')
|
self.assertRaises(AttributeError, frinkiac.response, '')
|
||||||
self.assertRaises(AttributeError, frinkiac.response, '[]')
|
self.assertRaises(AttributeError, frinkiac.response, '[]')
|
||||||
|
|
||||||
text = dumps([{'Id': 654234,
|
text = """
|
||||||
'Episode': 'S05E21',
|
[{"Id":770931,
|
||||||
'Timestamp': 3453455,
|
"Episode":"S06E18",
|
||||||
'Filename': ''},
|
"Timestamp":534616,
|
||||||
{'Id': 435354,
|
"Filename":""},
|
||||||
'Episode': 'S05E22',
|
{"Id":1657080,
|
||||||
'Timestamp': 3453456,
|
"Episode":"S12E14",
|
||||||
'Filename': ''},
|
"Timestamp":910868,
|
||||||
{'Id': 435333,
|
"Filename":""},
|
||||||
'Episode': 'S05E23',
|
{"Id":1943753,
|
||||||
'Timestamp': 3453457,
|
"Episode":"S14E21",
|
||||||
'Filename': ''},
|
"Timestamp":773439,
|
||||||
{'Id': 477234,
|
"Filename":""},
|
||||||
'Episode': 'S05E24',
|
{"Id":107835,
|
||||||
'Timestamp': 3453458,
|
"Episode":"S02E03",
|
||||||
'Filename': ''}])
|
"Timestamp":531709,
|
||||||
|
"Filename":""}]
|
||||||
|
"""
|
||||||
|
|
||||||
response = mock.Mock(text=text)
|
response = mock.Mock(text=text)
|
||||||
results = frinkiac.response(response)
|
results = frinkiac.response(response)
|
||||||
self.assertEqual(type(results), list)
|
self.assertEqual(type(results), list)
|
||||||
self.assertEqual(len(results), 4)
|
self.assertEqual(len(results), 4)
|
||||||
self.assertEqual(results[0]['title'], u'S05E21')
|
self.assertEqual(results[0]['title'], u'S06E18')
|
||||||
self.assertEqual(results[0]['url'], 'https://frinkiac.com/?p=caption&e=S05E21&t=3453455')
|
self.assertEqual(results[0]['url'], 'https://frinkiac.com/?p=caption&e=S06E18&t=534616')
|
||||||
self.assertEqual(results[0]['thumbnail_src'], 'https://frinkiac.com/img/S05E21/3453455/medium.jpg')
|
self.assertEqual(results[0]['thumbnail_src'], 'https://frinkiac.com/img/S06E18/534616/medium.jpg')
|
||||||
self.assertEqual(results[0]['img_src'], 'https://frinkiac.com/img/S05E21/3453455.jpg')
|
self.assertEqual(results[0]['img_src'], 'https://frinkiac.com/img/S06E18/534616.jpg')
|
||||||
|
|
Loading…
Reference in New Issue