|
@@ -26,19 +26,29 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
26
|
26
|
self.assertRaises(AttributeError, flickr_noapi.response, '')
|
27
|
27
|
self.assertRaises(AttributeError, flickr_noapi.response, '[]')
|
28
|
28
|
|
29
|
|
- response = mock.Mock(text='"search-photos-models","photos":{},"totalItems":')
|
|
29
|
+ response = mock.Mock(text='"search-photos-lite-models","photos":{},"totalItems":')
|
30
|
30
|
self.assertEqual(flickr_noapi.response(response), [])
|
31
|
31
|
|
32
|
|
- response = mock.Mock(text='search-photos-models","photos":{"data": []},"totalItems":')
|
|
32
|
+ response = mock.Mock(text='search-photos-lite-models","photos":{"data": []},"totalItems":')
|
33
|
33
|
self.assertEqual(flickr_noapi.response(response), [])
|
34
|
34
|
|
|
35
|
+ # everthing is ok test
|
35
|
36
|
json = """
|
36
|
|
- "search-photos-models","photos":
|
|
37
|
+ "search-photos-lite-models","photos":
|
37
|
38
|
{
|
38
|
39
|
"_data": [
|
39
|
40
|
{
|
40
|
|
- "_flickrModelRegistry": "photo-models",
|
|
41
|
+ "_flickrModelRegistry": "photo-lite-models",
|
41
|
42
|
"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",
|
42
|
52
|
"sizes": {
|
43
|
53
|
"c": {
|
44
|
54
|
"displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_c.jpg",
|
|
@@ -117,40 +127,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
117
|
127
|
"url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_z.jpg",
|
118
|
128
|
"key": "z"
|
119
|
129
|
}
|
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
|
+ }
|
154
|
131
|
}
|
155
|
132
|
],
|
156
|
133
|
"fetchedStart": true,
|
|
@@ -168,15 +145,24 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
168
|
145
|
self.assertIn('k.jpg', results[0]['img_src'])
|
169
|
146
|
self.assertIn('n.jpg', results[0]['thumbnail_src'])
|
170
|
147
|
self.assertIn('Owner', results[0]['content'])
|
171
|
|
- self.assertIn('Description', results[0]['content'])
|
172
|
148
|
|
|
149
|
+ # no n size, only the z size
|
173
|
150
|
json = """
|
174
|
|
- "search-photos-models","photos":
|
|
151
|
+ "search-photos-lite-models","photos":
|
175
|
152
|
{
|
176
|
153
|
"_data": [
|
177
|
154
|
{
|
178
|
|
- "_flickrModelRegistry": "photo-models",
|
|
155
|
+ "_flickrModelRegistry": "photo-lite-models",
|
179
|
156
|
"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",
|
180
|
166
|
"sizes": {
|
181
|
167
|
"z": {
|
182
|
168
|
"displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_z.jpg",
|
|
@@ -185,40 +171,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
185
|
171
|
"url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_z.jpg",
|
186
|
172
|
"key": "z"
|
187
|
173
|
}
|
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
|
+ }
|
222
|
175
|
}
|
223
|
176
|
],
|
224
|
177
|
"fetchedStart": true,
|
|
@@ -235,15 +188,24 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
235
|
188
|
self.assertIn('z.jpg', results[0]['img_src'])
|
236
|
189
|
self.assertIn('z.jpg', results[0]['thumbnail_src'])
|
237
|
190
|
self.assertIn('Owner', results[0]['content'])
|
238
|
|
- self.assertIn('Description', results[0]['content'])
|
239
|
191
|
|
|
192
|
+ # no z or n size
|
240
|
193
|
json = """
|
241
|
|
- "search-photos-models","photos":
|
|
194
|
+ "search-photos-lite-models","photos":
|
242
|
195
|
{
|
243
|
196
|
"_data": [
|
244
|
197
|
{
|
245
|
|
- "_flickrModelRegistry": "photo-models",
|
|
198
|
+ "_flickrModelRegistry": "photo-lite-models",
|
246
|
199
|
"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",
|
247
|
209
|
"sizes": {
|
248
|
210
|
"o": {
|
249
|
211
|
"displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_o.jpg",
|
|
@@ -252,39 +214,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
252
|
214
|
"url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_o.jpg",
|
253
|
215
|
"key": "o"
|
254
|
216
|
}
|
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
|
+ }
|
288
|
218
|
}
|
289
|
219
|
],
|
290
|
220
|
"fetchedStart": true,
|
|
@@ -302,48 +232,25 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
302
|
232
|
self.assertIn('o.jpg', results[0]['thumbnail_src'])
|
303
|
233
|
self.assertIn('Owner', results[0]['content'])
|
304
|
234
|
|
|
235
|
+ # no image test
|
305
|
236
|
json = """
|
306
|
|
- "search-photos-models","photos":
|
|
237
|
+ "search-photos-lite-models","photos":
|
307
|
238
|
{
|
308
|
239
|
"_data": [
|
309
|
240
|
{
|
310
|
|
- "_flickrModelRegistry": "photo-models",
|
|
241
|
+ "_flickrModelRegistry": "photo-lite-models",
|
311
|
242
|
"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",
|
342
|
246
|
"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
|
+ }
|
347
|
254
|
}
|
348
|
255
|
],
|
349
|
256
|
"fetchedStart": true,
|
|
@@ -356,6 +263,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
356
|
263
|
self.assertEqual(type(results), list)
|
357
|
264
|
self.assertEqual(len(results), 0)
|
358
|
265
|
|
|
266
|
+ # null test
|
359
|
267
|
json = """
|
360
|
268
|
"search-photos-models","photos":
|
361
|
269
|
{
|
|
@@ -370,13 +278,22 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
370
|
278
|
self.assertEqual(type(results), list)
|
371
|
279
|
self.assertEqual(len(results), 0)
|
372
|
280
|
|
|
281
|
+ # no ownerNsid test
|
373
|
282
|
json = """
|
374
|
|
- "search-photos-models","photos":
|
|
283
|
+ "search-photos-lite-models","photos":
|
375
|
284
|
{
|
376
|
285
|
"_data": [
|
377
|
286
|
{
|
378
|
|
- "_flickrModelRegistry": "photo-models",
|
|
287
|
+ "_flickrModelRegistry": "photo-lite-models",
|
379
|
288
|
"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",
|
380
|
297
|
"sizes": {
|
381
|
298
|
"o": {
|
382
|
299
|
"displayUrl": "//farm8.staticflickr.com/7246/14001294434_410f653777_o.jpg",
|
|
@@ -385,39 +302,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
385
|
302
|
"url": "//c4.staticflickr.com/8/7246/14001294434_410f653777_o.jpg",
|
386
|
303
|
"key": "o"
|
387
|
304
|
}
|
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
|
+ }
|
421
|
306
|
}
|
422
|
307
|
],
|
423
|
308
|
"fetchedStart": true,
|
|
@@ -430,6 +315,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
430
|
315
|
self.assertEqual(type(results), list)
|
431
|
316
|
self.assertEqual(len(results), 0)
|
432
|
317
|
|
|
318
|
+ # garbage test
|
433
|
319
|
json = """
|
434
|
320
|
{"toto":[
|
435
|
321
|
{"id":200,"name":"Artist Name",
|