@@ -26,19 +26,29 @@ class TestFlickrNoapiEngine(SearxTestCase):
2626 self.assertRaises(AttributeError, flickr_noapi.response, '')
2727 self.assertRaises(AttributeError, flickr_noapi.response, '[]')
2828
29− response = mock.Mock(text='"search-photos-models","photos":{},"totalItems":')
29+ response = mock.Mock(text='"search-photos-lite-models","photos":{},"totalItems":')
3030 self.assertEqual(flickr_noapi.response(response), [])
3131
32− response = mock.Mock(text='search-photos-models","photos":{"data": []},"totalItems":')
32+ response = mock.Mock(text='search-photos-lite-models","photos":{"data": []},"totalItems":')
3333 self.assertEqual(flickr_noapi.response(response), [])
3434
35+ # everthing is ok test
3536 json = """
36− "search-photos-models","photos":
37+ "search-photos-lite-models","photos":
3738 {
3839 "_data": [
3940 {
40− "_flickrModelRegistry": "photo-models",
41+ "_flickrModelRegistry": "photo-lite-models",
4142 "title": "This is the title",
43+ "username": "Owner",
44+ "pathAlias": "klink692",
45+ "realname": "Owner",
46+ "license": 0,
47+ "ownerNsid": "59729010@N00",
48+ "canComment": false,
49+ "commentCount": 14,
50+ "faveCount": 21,
51+ "id": "14001294434",
4252 "sizes": {
4353 "c": {
4454 "displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_c.jpg",
@@ -117,40 +127,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
117127 "url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_z.jpg",
118128 "key": "z"
119129 }
120− },
121− "canComment": false,
122− "rotation": 0,
123− "owner": {
124− "_flickrModelRegistry": "person-models",
125− "pathAlias": "klink692",
126− "username": "Owner",
127− "buddyicon": {
128− "retina": null,
129− "large": null,
130− "medium": null,
131− "small": null,
132− "default": "//c1.staticflickr.com/9/8108/buddyicons/59729010@N00.jpg?1361642376#59729010@N00"
133− },
134− "isPro": true,
135− "id": "59729010@N00"
136− },
137− "engagement": {
138− "_flickrModelRegistry": "photo-engagement-models",
139− "ownerNsid": "59729010@N00",
140− "faveCount": 21,
141− "commentCount": 14,
142− "viewCount": 10160,
143− "id": "14001294434"
144− },
145− "description": "Description",
146− "isHD": false,
147− "secret": "410f653777",
148− "canAddMeta": false,
149− "license": 0,
150− "oWidth": 1803,
151− "oHeight": 2669,
152− "safetyLevel": 0,
153− "id": "14001294434"
130+ }
154131 }
155132 ],
156133 "fetchedStart": true,
@@ -168,15 +145,24 @@ class TestFlickrNoapiEngine(SearxTestCase):
168145 self.assertIn('k.jpg', results[0]['img_src'])
169146 self.assertIn('n.jpg', results[0]['thumbnail_src'])
170147 self.assertIn('Owner', results[0]['content'])
171− self.assertIn('Description', results[0]['content'])
172148
149+ # no n size, only the z size
173150 json = """
174− "search-photos-models","photos":
151+ "search-photos-lite-models","photos":
175152 {
176153 "_data": [
177154 {
178− "_flickrModelRegistry": "photo-models",
155+ "_flickrModelRegistry": "photo-lite-models",
179156 "title": "This is the title",
157+ "username": "Owner",
158+ "pathAlias": "klink692",
159+ "realname": "Owner",
160+ "license": 0,
161+ "ownerNsid": "59729010@N00",
162+ "canComment": false,
163+ "commentCount": 14,
164+ "faveCount": 21,
165+ "id": "14001294434",
180166 "sizes": {
181167 "z": {
182168 "displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_z.jpg",
@@ -185,40 +171,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
185171 "url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_z.jpg",
186172 "key": "z"
187173 }
188− },
189− "canComment": false,
190− "rotation": 0,
191− "owner": {
192− "_flickrModelRegistry": "person-models",
193− "pathAlias": "klink692",
194− "username": "Owner",
195− "buddyicon": {
196− "retina": null,
197− "large": null,
198− "medium": null,
199− "small": null,
200− "default": "//c1.staticflickr.com/9/8108/buddyicons/59729010@N00.jpg?1361642376#59729010@N00"
201− },
202− "isPro": true,
203− "id": "59729010@N00"
204− },
205− "engagement": {
206− "_flickrModelRegistry": "photo-engagement-models",
207− "ownerNsid": "59729010@N00",
208− "faveCount": 21,
209− "commentCount": 14,
210− "viewCount": 10160,
211− "id": "14001294434"
212− },
213− "description": "Description",
214− "isHD": false,
215− "secret": "410f653777",
216− "canAddMeta": false,
217− "license": 0,
218− "oWidth": 1803,
219− "oHeight": 2669,
220− "safetyLevel": 0,
221− "id": "14001294434"
174+ }
222175 }
223176 ],
224177 "fetchedStart": true,
@@ -235,15 +188,24 @@ class TestFlickrNoapiEngine(SearxTestCase):
235188 self.assertIn('z.jpg', results[0]['img_src'])
236189 self.assertIn('z.jpg', results[0]['thumbnail_src'])
237190 self.assertIn('Owner', results[0]['content'])
238− self.assertIn('Description', results[0]['content'])
239191
192+ # no z or n size
240193 json = """
241− "search-photos-models","photos":
194+ "search-photos-lite-models","photos":
242195 {
243196 "_data": [
244197 {
245− "_flickrModelRegistry": "photo-models",
198+ "_flickrModelRegistry": "photo-lite-models",
246199 "title": "This is the title",
200+ "username": "Owner",
201+ "pathAlias": "klink692",
202+ "realname": "Owner",
203+ "license": 0,
204+ "ownerNsid": "59729010@N00",
205+ "canComment": false,
206+ "commentCount": 14,
207+ "faveCount": 21,
208+ "id": "14001294434",
247209 "sizes": {
248210 "o": {
249211 "displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_o.jpg",
@@ -252,39 +214,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
252214 "url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_o.jpg",
253215 "key": "o"
254216 }
255− },
256− "canComment": false,
257− "rotation": 0,
258− "owner": {
259− "_flickrModelRegistry": "person-models",
260− "pathAlias": "klink692",
261− "username": "Owner",
262− "buddyicon": {
263− "retina": null,
264− "large": null,
265− "medium": null,
266− "small": null,
267− "default": "//c1.staticflickr.com/9/8108/buddyicons/59729010@N00.jpg?1361642376#59729010@N00"
268− },
269− "isPro": true,
270− "id": "59729010@N00"
271− },
272− "engagement": {
273− "_flickrModelRegistry": "photo-engagement-models",
274− "ownerNsid": "59729010@N00",
275− "faveCount": 21,
276− "commentCount": 14,
277− "viewCount": 10160,
278− "id": "14001294434"
279− },
280− "isHD": false,
281− "secret": "410f653777",
282− "canAddMeta": false,
283− "license": 0,
284− "oWidth": 1803,
285− "oHeight": 2669,
286− "safetyLevel": 0,
287− "id": "14001294434"
217+ }
288218 }
289219 ],
290220 "fetchedStart": true,
@@ -302,48 +232,25 @@ class TestFlickrNoapiEngine(SearxTestCase):
302232 self.assertIn('o.jpg', results[0]['thumbnail_src'])
303233 self.assertIn('Owner', results[0]['content'])
304234
235+ # no image test
305236 json = """
306− "search-photos-models","photos":
237+ "search-photos-lite-models","photos":
307238 {
308239 "_data": [
309240 {
310− "_flickrModelRegistry": "photo-models",
241+ "_flickrModelRegistry": "photo-lite-models",
311242 "title": "This is the title",
312− "sizes": {
313− },
314− "canComment": false,
315− "rotation": 0,
316− "owner": {
317− "_flickrModelRegistry": "person-models",
318− "pathAlias": "klink692",
319− "username": "Owner",
320− "buddyicon": {
321− "retina": null,
322− "large": null,
323− "medium": null,
324− "small": null,
325− "default": "//c1.staticflickr.com/9/8108/buddyicons/59729010@N00.jpg?1361642376#59729010@N00"
326− },
327− "isPro": true,
328− "id": "59729010@N00"
329− },
330− "engagement": {
331− "_flickrModelRegistry": "photo-engagement-models",
332− "ownerNsid": "59729010@N00",
333− "faveCount": 21,
334− "commentCount": 14,
335− "viewCount": 10160,
336− "id": "14001294434"
337− },
338− "description": "Description",
339− "isHD": false,
340− "secret": "410f653777",
341− "canAddMeta": false,
243+ "username": "Owner",
244+ "pathAlias": "klink692",
245+ "realname": "Owner",
342246 "license": 0,
343− "oWidth": 1803,
344− "oHeight": 2669,
345− "safetyLevel": 0,
346− "id": "14001294434"
247+ "ownerNsid": "59729010@N00",
248+ "canComment": false,
249+ "commentCount": 14,
250+ "faveCount": 21,
251+ "id": "14001294434",
252+ "sizes": {
253+ }
347254 }
348255 ],
349256 "fetchedStart": true,
@@ -356,6 +263,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
356263 self.assertEqual(type(results), list)
357264 self.assertEqual(len(results), 0)
358265
266+ # null test
359267 json = """
360268 "search-photos-models","photos":
361269 {
@@ -370,13 +278,22 @@ class TestFlickrNoapiEngine(SearxTestCase):
370278 self.assertEqual(type(results), list)
371279 self.assertEqual(len(results), 0)
372280
281+ # no ownerNsid test
373282 json = """
374− "search-photos-models","photos":
283+ "search-photos-lite-models","photos":
375284 {
376285 "_data": [
377286 {
378− "_flickrModelRegistry": "photo-models",
287+ "_flickrModelRegistry": "photo-lite-models",
379288 "title": "This is the title",
289+ "username": "Owner",
290+ "pathAlias": "klink692",
291+ "realname": "Owner",
292+ "license": 0,
293+ "canComment": false,
294+ "commentCount": 14,
295+ "faveCount": 21,
296+ "id": "14001294434",
380297 "sizes": {
381298 "o": {
382299 "displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_o.jpg",
@@ -385,39 +302,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
385302 "url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_o.jpg",
386303 "key": "o"
387304 }
388− },
389− "canComment": false,
390− "rotation": 0,
391− "owner": {
392− "_flickrModelRegistry": "person-models",
393− "pathAlias": "klink692",
394− "username": "Owner",
395− "buddyicon": {
396− "retina": null,
397− "large": null,
398− "medium": null,
399− "small": null,
400− "default": "//c1.staticflickr.com/9/8108/buddyicons/59729010@N00.jpg?1361642376#59729010@N00"
401− },
402− "isPro": true
403− },
404− "engagement": {
405− "_flickrModelRegistry": "photo-engagement-models",
406− "ownerNsid": "59729010@N00",
407− "faveCount": 21,
408− "commentCount": 14,
409− "viewCount": 10160,
410− "id": "14001294434"
411− },
412− "description": "Description",
413− "isHD": false,
414− "secret": "410f653777",
415− "canAddMeta": false,
416− "license": 0,
417− "oWidth": 1803,
418− "oHeight": 2669,
419− "safetyLevel": 0,
420− "id": "14001294434"
305+ }
421306 }
422307 ],
423308 "fetchedStart": true,
@@ -430,6 +315,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
430315 self.assertEqual(type(results), list)
431316 self.assertEqual(len(results), 0)
432317
318+ # garbage test
433319 json = """
434320 {"toto":[
435321 {"id":200,"name":"Artist Name",