LEFT | RIGHT |
(no file at all) | |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ( | 246 ( |
247 datetime(2013, 07, 31, 12, 03, 00), | 247 datetime(2013, 07, 31, 12, 03, 00), |
248 'easylist.txt', | 248 'easylist.txt', |
249 '_=1375142394357', | 249 '_=1375142394357', |
250 'AdBlock/2.5.4', | 250 'AdBlock/2.5.4', |
251 'chromeadblock/2.5.4', | 251 'chromeadblock/2.5.4', |
252 'unknown/unknown', | 252 'unknown/unknown', |
253 'unknown/unknown', | 253 'unknown/unknown', |
254 'unknown', | 254 'unknown', |
255 'unknown', | 255 'unknown', |
256 '' | 256 '', |
257 ), | 257 ), |
258 ] | 258 ] |
259 for time, file, query, clientid, expected_addon, expected_application, e
xpected_platform, expected_interval, expected_previous, expected_flags in tests: | 259 for time, file, query, clientid, expected_addon, expected_application, e
xpected_platform, expected_interval, expected_previous, expected_flags in tests: |
260 info = {'time': time, 'file': file, 'query': query, 'clientid': clie
ntid} | 260 info = {'time': time, 'file': file, 'query': query, 'clientid': clie
ntid} |
261 logprocessor.parse_downloader_query(info) | 261 logprocessor.parse_downloader_query(info) |
262 self.assertEqual('%s/%s' % (info['addonName'], info['addonVersion'])
, expected_addon, "Add-on for query '%s'" % query) | 262 self.assertEqual('%s/%s' % (info['addonName'], info['addonVersion'])
, expected_addon, "Add-on for query '%s'" % query) |
263 self.assertEqual('%s/%s' % (info['application'], info['applicationVe
rsion']), expected_application, "Application for query '%s'" % query) | 263 self.assertEqual('%s/%s' % (info['application'], info['applicationVe
rsion']), expected_application, "Application for query '%s'" % query) |
264 self.assertEqual('%s/%s' % (info['platform'], info['platformVersion'
]), expected_platform, "Platform for query '%s'" % query) | 264 self.assertEqual('%s/%s' % (info['platform'], info['platformVersion'
]), expected_platform, "Platform for query '%s'" % query) |
265 self.assertEqual(info['downloadInterval'], expected_interval, "Downl
oad interval for query '%s'" % query) | 265 self.assertEqual(info['downloadInterval'], expected_interval, "Downl
oad interval for query '%s'" % query) |
266 self.assertEqual(info['previousDownload'], expected_previous, "Previ
ous download for query '%s'" % query) | 266 self.assertEqual(info['previousDownload'], expected_previous, "Previ
ous download for query '%s'" % query) |
(...skipping 10 matching lines...) Expand all Loading... |
277 ('adblockpluschrome-experimental/updates.xml', 'adblockpluschrome-ex
perimental'), | 277 ('adblockpluschrome-experimental/updates.xml', 'adblockpluschrome-ex
perimental'), |
278 ('update.json', None), | 278 ('update.json', None), |
279 ] | 279 ] |
280 for file, expected_name in tests: | 280 for file, expected_name in tests: |
281 self.assertEqual(logprocessor.parse_addon_name(file), expected_name,
"Getting add-on name for file '%s'" % file) | 281 self.assertEqual(logprocessor.parse_addon_name(file), expected_name,
"Getting add-on name for file '%s'" % file) |
282 | 282 |
283 def test_geckoqueryparsing(self): | 283 def test_geckoqueryparsing(self): |
284 tests = [ | 284 tests = [ |
285 ( | 285 ( |
286 'reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=
2.3.1.3707&maxAppVersion=25.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-
13a3a9e97384}&appVersion=22.0&appOS=Darwin&appABI=x86_64-gcc3&locale=en-US&curre
ntAppVersion=22.0&updateType=112', | 286 'reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=
2.3.1.3707&maxAppVersion=25.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-
13a3a9e97384}&appVersion=22.0&appOS=Darwin&appABI=x86_64-gcc3&locale=en-US&curre
ntAppVersion=22.0&updateType=112', |
287 '2.3.1.3707', 'firefox', '22.0' | 287 '2.3.1.3707', 'firefox', '22.0', |
288 ), | 288 ), |
289 ( | 289 ( |
290 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74
&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e973
84}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVers
ion=25.0a1&updateType=97', | 290 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74
&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e973
84}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVers
ion=25.0a1&updateType=97', |
291 '1.0.4a.74', 'firefox', '25.0' | 291 '1.0.4a.74', 'firefox', '25.0', |
292 ), | 292 ), |
293 ( | 293 ( |
294 'reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=
1.3a.20100925&maxAppVersion=2.1b1&status=userEnabled,incompatible&appID={92650c4
d-4b8e-4d2a-b7eb-24ecf4f6b63a}&appVersion=2.19&appOS=WINNT&appABI=x86-msvc&local
e=en-US¤tAppVersion=2.19&updateType=112', | 294 'reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=
1.3a.20100925&maxAppVersion=2.1b1&status=userEnabled,incompatible&appID={92650c4
d-4b8e-4d2a-b7eb-24ecf4f6b63a}&appVersion=2.19&appOS=WINNT&appABI=x86-msvc&local
e=en-US¤tAppVersion=2.19&updateType=112', |
295 '1.3a.20100925', 'seamonkey', '2.19' | 295 '1.3a.20100925', 'seamonkey', '2.19', |
296 ), | 296 ), |
297 ] | 297 ] |
298 for query, expected_version, expected_application, expected_applicationv
ersion in tests: | 298 for query, expected_version, expected_application, expected_applicationv
ersion in tests: |
299 self.assertEqual(logprocessor.parse_gecko_query(query), (expected_ve
rsion, expected_application, expected_applicationversion), "Parsing Gecko query
'%s'" % query) | 299 self.assertEqual(logprocessor.parse_gecko_query(query), (expected_ve
rsion, expected_application, expected_applicationversion), "Parsing Gecko query
'%s'" % query) |
300 | 300 |
301 def test_chromequeryparsing(self): | 301 def test_chromequeryparsing(self): |
302 tests = [ | 302 tests = [ |
303 ( | 303 ( |
304 'os=win&arch=x86&nacl_arch=x86-64&prod=chromecrx&prodchannel=sta
ble&prodversion=28.0.1500.72&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3
.977%26uc', | 304 'os=win&arch=x86&nacl_arch=x86-64&prod=chromecrx&prodchannel=sta
ble&prodversion=28.0.1500.72&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3
.977%26uc', |
305 '1.5.3.977', 'chrome', '28.0' | 305 '1.5.3.977', 'chrome', '28.0', |
306 ), | 306 ), |
307 ( | 307 ( |
308 'x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc', | 308 'x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc', |
309 '1.5.3.977', 'unknown', 'unknown' | 309 '1.5.3.977', 'unknown', 'unknown', |
310 ), | 310 ), |
311 ( | 311 ( |
312 'api=15&build=256&locale=ru_ru&device=LGE%20LG-P990', | 312 'api=15&build=256&locale=ru_ru&device=LGE%20LG-P990', |
313 'unknown', 'unknown', 'unknown' | 313 'unknown', 'unknown', 'unknown', |
314 ), | 314 ), |
315 ] | 315 ] |
316 for query, expected_version, expected_application, expected_applicationv
ersion in tests: | 316 for query, expected_version, expected_application, expected_applicationv
ersion in tests: |
317 self.assertEqual(logprocessor.parse_chrome_query(query), (expected_v
ersion, expected_application, expected_applicationversion), "Parsing Chrome quer
y '%s'" % query) | 317 self.assertEqual(logprocessor.parse_chrome_query(query), (expected_v
ersion, expected_application, expected_applicationversion), "Parsing Chrome quer
y '%s'" % query) |
318 | 318 |
319 def test_updateflagparsing(self): | 319 def test_updateflagparsing(self): |
320 tests = [ | 320 tests = [ |
321 ('update', 'update'), | 321 ('update', 'update'), |
322 ('', 'install'), | 322 ('', 'install'), |
323 ('foo', 'install'), | 323 ('foo', 'install'), |
(...skipping 26 matching lines...) Expand all Loading... |
350 'ua': 'Chrome', | 350 'ua': 'Chrome', |
351 'uaversion': '28.0', | 351 'uaversion': '28.0', |
352 'fullua': 'Chrome 28.0', | 352 'fullua': 'Chrome 28.0', |
353 'clientid': '-', | 353 'clientid': '-', |
354 'addonName': 'adblockpluschrome', | 354 'addonName': 'adblockpluschrome', |
355 'addonVersion': '1.5.3.977', | 355 'addonVersion': '1.5.3.977', |
356 'fullAddon': 'adblockpluschrome 1.5.3.977', | 356 'fullAddon': 'adblockpluschrome 1.5.3.977', |
357 'application': 'chrome', | 357 'application': 'chrome', |
358 'applicationVersion': '28.0', | 358 'applicationVersion': '28.0', |
359 'fullApplication': 'chrome 28.0', | 359 'fullApplication': 'chrome 28.0', |
360 } | 360 }, |
361 ), | 361 ), |
362 ( | 362 ( |
363 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 404 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', | 363 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 404 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', |
364 None | 364 None, |
365 ), | 365 ), |
366 ( | 366 ( |
367 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 301 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', | 367 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 301 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', |
368 { | 368 { |
369 'ip': '1.2.3.4', | 369 'ip': '1.2.3.4', |
370 'country': 'xy', | 370 'country': 'xy', |
371 'time': datetime(2013, 7, 31, 17, 33, 8), | 371 'time': datetime(2013, 7, 31, 17, 33, 8), |
372 'day': 31, | 372 'day': 31, |
373 'weekday': 2, | 373 'weekday': 2, |
374 'hour': 17, | 374 'hour': 17, |
375 'month': '201307', | 375 'month': '201307', |
376 'file': 'devbuilds/abpcustomization/update.rdf', | 376 'file': 'devbuilds/abpcustomization/update.rdf', |
377 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', | 377 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', |
378 'size': 867, | 378 'size': 867, |
379 'referrer': '-', | 379 'referrer': '-', |
380 'status': 301, | 380 'status': 301, |
381 'ua': 'Firefox', | 381 'ua': 'Firefox', |
382 'uaversion': '25.0', | 382 'uaversion': '25.0', |
383 'fullua': 'Firefox 25.0', | 383 'fullua': 'Firefox 25.0', |
384 'clientid': '-', | 384 'clientid': '-', |
385 'addonName': 'abpcustomization', | 385 'addonName': 'abpcustomization', |
386 'addonVersion': '1.0.4a.74', | 386 'addonVersion': '1.0.4a.74', |
387 'fullAddon': 'abpcustomization 1.0.4a.74', | 387 'fullAddon': 'abpcustomization 1.0.4a.74', |
388 'application': 'firefox', | 388 'application': 'firefox', |
389 'applicationVersion': '25.0', | 389 'applicationVersion': '25.0', |
390 'fullApplication': 'firefox 25.0', | 390 'fullApplication': 'firefox 25.0', |
391 } | 391 }, |
392 ), | 392 ), |
393 ( | 393 ( |
394 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 302 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', | 394 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 302 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', |
395 { | 395 { |
396 'ip': '1.2.3.4', | 396 'ip': '1.2.3.4', |
397 'country': 'xy', | 397 'country': 'xy', |
398 'time': datetime(2013, 7, 31, 17, 33, 8), | 398 'time': datetime(2013, 7, 31, 17, 33, 8), |
399 'day': 31, | 399 'day': 31, |
400 'weekday': 2, | 400 'weekday': 2, |
401 'hour': 17, | 401 'hour': 17, |
402 'month': '201307', | 402 'month': '201307', |
403 'file': 'devbuilds/abpcustomization/update.rdf', | 403 'file': 'devbuilds/abpcustomization/update.rdf', |
404 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', | 404 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', |
405 'size': 867, | 405 'size': 867, |
406 'referrer': '-', | 406 'referrer': '-', |
407 'status': 302, | 407 'status': 302, |
408 'ua': 'Firefox', | 408 'ua': 'Firefox', |
409 'uaversion': '25.0', | 409 'uaversion': '25.0', |
410 'fullua': 'Firefox 25.0', | 410 'fullua': 'Firefox 25.0', |
411 'clientid': '-', | 411 'clientid': '-', |
412 'addonName': 'abpcustomization', | 412 'addonName': 'abpcustomization', |
413 'addonVersion': '1.0.4a.74', | 413 'addonVersion': '1.0.4a.74', |
414 'fullAddon': 'abpcustomization 1.0.4a.74', | 414 'fullAddon': 'abpcustomization 1.0.4a.74', |
415 'application': 'firefox', | 415 'application': 'firefox', |
416 'applicationVersion': '25.0', | 416 'applicationVersion': '25.0', |
417 'fullApplication': 'firefox 25.0', | 417 'fullApplication': 'firefox 25.0', |
418 } | 418 }, |
419 ), | 419 ), |
420 ( | 420 ( |
421 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.unknown?reqVersion=2&id=customization@adblockplus.org&version=
1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-1
3a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&curre
ntAppVersion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT
6.1; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "down
loads.adblockplus.org" "-"', | 421 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.unknown?reqVersion=2&id=customization@adblockplus.org&version=
1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-1
3a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&curre
ntAppVersion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT
6.1; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "down
loads.adblockplus.org" "-"', |
422 None | 422 None, |
423 ), | 423 ), |
424 ( | 424 ( |
425 '1.2.3.4 corrupted', | 425 '1.2.3.4 corrupted', |
426 None | 426 None, |
427 ), | 427 ), |
428 ( | 428 ( |
429 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', | 429 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcus
tomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.
4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a
9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAp
pVersion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT 6.1
; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "download
s.adblockplus.org" "-"', |
430 { | 430 { |
431 'ip': '1.2.3.4', | 431 'ip': '1.2.3.4', |
432 'country': 'xy', | 432 'country': 'xy', |
433 'time': datetime(2013, 7, 31, 17, 33, 8), | 433 'time': datetime(2013, 7, 31, 17, 33, 8), |
434 'day': 31, | 434 'day': 31, |
435 'weekday': 2, | 435 'weekday': 2, |
436 'hour': 17, | 436 'hour': 17, |
437 'month': '201307', | 437 'month': '201307', |
438 'file': 'devbuilds/abpcustomization/update.rdf', | 438 'file': 'devbuilds/abpcustomization/update.rdf', |
439 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', | 439 'query': 'reqVersion=2&id=customization@adblockplus.org&vers
ion=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b
0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&c
urrentAppVersion=25.0a1&updateType=97', |
440 'size': 867, | 440 'size': 867, |
441 'referrer': '-', | 441 'referrer': '-', |
442 'status': 200, | 442 'status': 200, |
443 'ua': 'Firefox', | 443 'ua': 'Firefox', |
444 'uaversion': '25.0', | 444 'uaversion': '25.0', |
445 'fullua': 'Firefox 25.0', | 445 'fullua': 'Firefox 25.0', |
446 'clientid': '-', | 446 'clientid': '-', |
447 'addonName': 'abpcustomization', | 447 'addonName': 'abpcustomization', |
448 'addonVersion': '1.0.4a.74', | 448 'addonVersion': '1.0.4a.74', |
449 'fullAddon': 'abpcustomization 1.0.4a.74', | 449 'fullAddon': 'abpcustomization 1.0.4a.74', |
450 'application': 'firefox', | 450 'application': 'firefox', |
451 'applicationVersion': '25.0', | 451 'applicationVersion': '25.0', |
452 'fullApplication': 'firefox 25.0', | 452 'fullApplication': 'firefox 25.0', |
453 } | 453 }, |
454 ), | 454 ), |
455 ( | 455 ( |
456 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adbloc
kplusie/update.json?addonName=adblockplusie&addonVersion=2.0&application=msie64&
applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=
0 HTTP/1.1" 200 867 "-" "Adblock Plus" "-" https" "en-US" "downloads.adblockplus
.org" "-"', | 456 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adbloc
kplusie/update.json?addonName=adblockplusie&addonVersion=2.0&application=msie64&
applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=
0 HTTP/1.1" 200 867 "-" "Adblock Plus" "-" https" "en-US" "downloads.adblockplus
.org" "-"', |
457 { | 457 { |
458 'ip': '1.2.3.4', | 458 'ip': '1.2.3.4', |
459 'country': 'xy', | 459 'country': 'xy', |
460 'time': datetime(2013, 7, 31, 17, 33, 8), | 460 'time': datetime(2013, 7, 31, 17, 33, 8), |
461 'day': 31, | 461 'day': 31, |
462 'weekday': 2, | 462 'weekday': 2, |
463 'hour': 17, | 463 'hour': 17, |
(...skipping 12 matching lines...) Expand all Loading... |
476 'fullAddon': 'adblockplusie 2.0', | 476 'fullAddon': 'adblockplusie 2.0', |
477 'application': 'msie64', | 477 'application': 'msie64', |
478 'applicationVersion': '10.0', | 478 'applicationVersion': '10.0', |
479 'fullApplication': 'msie64 10.0', | 479 'fullApplication': 'msie64 10.0', |
480 'platform': 'libadblockplus', | 480 'platform': 'libadblockplus', |
481 'platformVersion': '1.0', | 481 'platformVersion': '1.0', |
482 'fullPlatform': 'libadblockplus 1.0', | 482 'fullPlatform': 'libadblockplus 1.0', |
483 'downloadInterval': 'unknown', | 483 'downloadInterval': 'unknown', |
484 'previousDownload': 'unknown', | 484 'previousDownload': 'unknown', |
485 'firstDownload': True, | 485 'firstDownload': True, |
486 } | 486 }, |
487 ), | 487 ), |
488 ( | 488 ( |
489 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /adblockplusandro
id-1.1.2.apk HTTP/1.1" 200 49152 "https://adblockplus.org/en/android-install" "M
ozilla/5.0 (Linux; U; Android 4.1.2; es-es; GT-I9100 Build/JZO54K) AppleWebKit/5
34.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" "-" https "en-US" "d
ownloads.adblockplus.org" "-"', | 489 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /adblockplusandro
id-1.1.2.apk HTTP/1.1" 200 49152 "https://adblockplus.org/en/android-install" "M
ozilla/5.0 (Linux; U; Android 4.1.2; es-es; GT-I9100 Build/JZO54K) AppleWebKit/5
34.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" "-" https "en-US" "d
ownloads.adblockplus.org" "-"', |
490 { | 490 { |
491 'ip': '1.2.3.4', | 491 'ip': '1.2.3.4', |
492 'country': 'xy', | 492 'country': 'xy', |
493 'time': datetime(2013, 7, 31, 17, 33, 8), | 493 'time': datetime(2013, 7, 31, 17, 33, 8), |
494 'day': 31, | 494 'day': 31, |
495 'weekday': 2, | 495 'weekday': 2, |
496 'hour': 17, | 496 'hour': 17, |
497 'month': '201307', | 497 'month': '201307', |
498 'file': 'adblockplusandroid-1.1.2.apk', | 498 'file': 'adblockplusandroid-1.1.2.apk', |
499 'query': '', | 499 'query': '', |
500 'size': 49152, | 500 'size': 49152, |
501 'referrer': 'https://adblockplus.org/en/android-install', | 501 'referrer': 'https://adblockplus.org/en/android-install', |
502 'status': 200, | 502 'status': 200, |
503 'ua': 'Mobile Safari', | 503 'ua': 'Mobile Safari', |
504 'uaversion': '4.0', | 504 'uaversion': '4.0', |
505 'fullua': 'Mobile Safari 4.0', | 505 'fullua': 'Mobile Safari 4.0', |
506 'clientid': '-', | 506 'clientid': '-', |
507 'installType': 'install', | 507 'installType': 'install', |
508 } | 508 }, |
509 ), | 509 ), |
510 ( | 510 ( |
511 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adbloc
kplus/adblockplus-2.3.2.3712.xpi?update HTTP/1.1" 200 827261 "-" "Mozilla/5.0 (M
acintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0" "-" https', | 511 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adbloc
kplus/adblockplus-2.3.2.3712.xpi?update HTTP/1.1" 200 827261 "-" "Mozilla/5.0 (M
acintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0" "-" https', |
512 { | 512 { |
513 'ip': '1.2.3.4', | 513 'ip': '1.2.3.4', |
514 'country': 'xy', | 514 'country': 'xy', |
515 'time': datetime(2013, 7, 31, 17, 33, 8), | 515 'time': datetime(2013, 7, 31, 17, 33, 8), |
516 'day': 31, | 516 'day': 31, |
517 'weekday': 2, | 517 'weekday': 2, |
518 'hour': 17, | 518 'hour': 17, |
519 'month': '201307', | 519 'month': '201307', |
520 'file': 'devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi', | 520 'file': 'devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi', |
521 'query': 'update', | 521 'query': 'update', |
522 'size': 827261, | 522 'size': 827261, |
523 'referrer': '-', | 523 'referrer': '-', |
524 'status': 200, | 524 'status': 200, |
525 'ua': 'Firefox', | 525 'ua': 'Firefox', |
526 'uaversion': '22.0', | 526 'uaversion': '22.0', |
527 'fullua': 'Firefox 22.0', | 527 'fullua': 'Firefox 22.0', |
528 'clientid': None, | 528 'clientid': None, |
529 'installType': 'update', | 529 'installType': 'update', |
530 } | 530 }, |
531 ), | 531 ), |
532 ( | 532 ( |
533 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /exceptionrules.t
xt?addonName=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersi
on=22.0&platform=gecko&platformVersion=22.0&lastVersion=201307311503 HTTP/1.1" 2
00 14303 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/201001
01 Firefox/22.0" "-" https "en-US,en;q=0.5" "easylist-downloads.adblockplus.org"
"-"', | 533 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /exceptionrules.t
xt?addonName=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersi
on=22.0&platform=gecko&platformVersion=22.0&lastVersion=201307311503 HTTP/1.1" 2
00 14303 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/201001
01 Firefox/22.0" "-" https "en-US,en;q=0.5" "easylist-downloads.adblockplus.org"
"-"', |
534 { | 534 { |
535 'ip': '1.2.3.4', | 535 'ip': '1.2.3.4', |
536 'country': 'xy', | 536 'country': 'xy', |
537 'time': datetime(2013, 7, 31, 17, 33, 8), | 537 'time': datetime(2013, 7, 31, 17, 33, 8), |
538 'day': 31, | 538 'day': 31, |
539 'weekday': 2, | 539 'weekday': 2, |
540 'hour': 17, | 540 'hour': 17, |
(...skipping 11 matching lines...) Expand all Loading... |
552 'addonVersion': '2.3.2', | 552 'addonVersion': '2.3.2', |
553 'fullAddon': 'adblockplus 2.3.2', | 553 'fullAddon': 'adblockplus 2.3.2', |
554 'application': 'firefox', | 554 'application': 'firefox', |
555 'applicationVersion': '22.0', | 555 'applicationVersion': '22.0', |
556 'fullApplication': 'firefox 22.0', | 556 'fullApplication': 'firefox 22.0', |
557 'platform': 'gecko', | 557 'platform': 'gecko', |
558 'platformVersion': '22.0', | 558 'platformVersion': '22.0', |
559 'fullPlatform': 'gecko 22.0', | 559 'fullPlatform': 'gecko 22.0', |
560 'downloadInterval': '2 hour(s)', | 560 'downloadInterval': '2 hour(s)', |
561 'previousDownload': 'same day', | 561 'previousDownload': 'same day', |
562 } | 562 }, |
563 ), | 563 ), |
564 ( | 564 ( |
565 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylist.txt?_=1
375446528229 HTTP/1.1" 200 326120 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/
537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https "nl-NL,n
l;q=0.8,en-US;q=0.6,en;q=0.4" "easylist-downloads.adblockplus.org" "AdBlock/2.6.
2"', | 565 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylist.txt?_=1
375446528229 HTTP/1.1" 200 326120 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/
537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https "nl-NL,n
l;q=0.8,en-US;q=0.6,en;q=0.4" "easylist-downloads.adblockplus.org" "AdBlock/2.6.
2"', |
566 { | 566 { |
567 'ip': '1.2.3.4', | 567 'ip': '1.2.3.4', |
568 'country': 'xy', | 568 'country': 'xy', |
569 'time': datetime(2013, 7, 31, 17, 33, 8), | 569 'time': datetime(2013, 7, 31, 17, 33, 8), |
570 'day': 31, | 570 'day': 31, |
571 'weekday': 2, | 571 'weekday': 2, |
572 'hour': 17, | 572 'hour': 17, |
(...skipping 11 matching lines...) Expand all Loading... |
584 'addonVersion': '2.6.2', | 584 'addonVersion': '2.6.2', |
585 'fullAddon': 'chromeadblock 2.6.2', | 585 'fullAddon': 'chromeadblock 2.6.2', |
586 'application': 'unknown', | 586 'application': 'unknown', |
587 'applicationVersion': 'unknown', | 587 'applicationVersion': 'unknown', |
588 'fullApplication': 'unknown unknown', | 588 'fullApplication': 'unknown unknown', |
589 'platform': 'unknown', | 589 'platform': 'unknown', |
590 'platformVersion': 'unknown', | 590 'platformVersion': 'unknown', |
591 'fullPlatform': 'unknown unknown', | 591 'fullPlatform': 'unknown unknown', |
592 'downloadInterval': 'unknown', | 592 'downloadInterval': 'unknown', |
593 'previousDownload': 'unknown', | 593 'previousDownload': 'unknown', |
594 } | 594 }, |
595 ), | 595 ), |
596 ( | 596 ( |
597 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tx
t HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org"
"-"', | 597 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tx
t HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org"
"-"', |
598 { | 598 { |
599 'ip': '1.2.3.4', | 599 'ip': '1.2.3.4', |
600 'country': 'xy', | 600 'country': 'xy', |
601 'time': datetime(2013, 7, 31, 17, 33, 8), | 601 'time': datetime(2013, 7, 31, 17, 33, 8), |
602 'day': 31, | 602 'day': 31, |
603 'weekday': 2, | 603 'weekday': 2, |
604 'hour': 17, | 604 'hour': 17, |
(...skipping 11 matching lines...) Expand all Loading... |
616 'addonVersion': 'unknown', | 616 'addonVersion': 'unknown', |
617 'fullAddon': 'unknown unknown', | 617 'fullAddon': 'unknown unknown', |
618 'application': 'unknown', | 618 'application': 'unknown', |
619 'applicationVersion': 'unknown', | 619 'applicationVersion': 'unknown', |
620 'fullApplication': 'unknown unknown', | 620 'fullApplication': 'unknown unknown', |
621 'platform': 'unknown', | 621 'platform': 'unknown', |
622 'platformVersion': 'unknown', | 622 'platformVersion': 'unknown', |
623 'fullPlatform': 'unknown unknown', | 623 'fullPlatform': 'unknown unknown', |
624 'downloadInterval': 'unknown', | 624 'downloadInterval': 'unknown', |
625 'previousDownload': 'unknown', | 625 'previousDownload': 'unknown', |
626 } | 626 }, |
627 ), | 627 ), |
628 ( | 628 ( |
629 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tp
l HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org"
"-"', | 629 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tp
l HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org"
"-"', |
630 { | 630 { |
631 'ip': '1.2.3.4', | 631 'ip': '1.2.3.4', |
632 'country': 'xy', | 632 'country': 'xy', |
633 'time': datetime(2013, 7, 31, 17, 33, 8), | 633 'time': datetime(2013, 7, 31, 17, 33, 8), |
634 'day': 31, | 634 'day': 31, |
635 'weekday': 2, | 635 'weekday': 2, |
636 'hour': 17, | 636 'hour': 17, |
637 'month': '201307', | 637 'month': '201307', |
638 'file': 'easylistitaly.tpl', | 638 'file': 'easylistitaly.tpl', |
639 'query': '', | 639 'query': '', |
640 'size': 85879, | 640 'size': 85879, |
641 'referrer': '-', | 641 'referrer': '-', |
642 'status': 200, | 642 'status': 200, |
643 'ua': 'Other', | 643 'ua': 'Other', |
644 'uaversion': '', | 644 'uaversion': '', |
645 'fullua': 'Other ', | 645 'fullua': 'Other ', |
646 'clientid': '-', | 646 'clientid': '-', |
647 } | 647 }, |
648 ), | 648 ), |
649 ( | 649 ( |
650 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /notification.jso
n?addonName=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationV
ersion=28.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=2
01307292310 HTTP/1.1" 200 299 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.
36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https', | 650 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /notification.jso
n?addonName=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationV
ersion=28.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=2
01307292310 HTTP/1.1" 200 299 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.
36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https', |
651 { | 651 { |
652 'ip': '1.2.3.4', | 652 'ip': '1.2.3.4', |
653 'country': 'xy', | 653 'country': 'xy', |
654 'time': datetime(2013, 7, 31, 17, 33, 8), | 654 'time': datetime(2013, 7, 31, 17, 33, 8), |
655 'day': 31, | 655 'day': 31, |
656 'weekday': 2, | 656 'weekday': 2, |
657 'hour': 17, | 657 'hour': 17, |
(...skipping 12 matching lines...) Expand all Loading... |
670 'fullAddon': 'adblockpluschrome 1.5.3', | 670 'fullAddon': 'adblockpluschrome 1.5.3', |
671 'application': 'chrome', | 671 'application': 'chrome', |
672 'applicationVersion': '28.0', | 672 'applicationVersion': '28.0', |
673 'fullApplication': 'chrome 28.0', | 673 'fullApplication': 'chrome 28.0', |
674 'platform': 'chromium', | 674 'platform': 'chromium', |
675 'platformVersion': '28.0', | 675 'platformVersion': '28.0', |
676 'fullPlatform': 'chromium 28.0', | 676 'fullPlatform': 'chromium 28.0', |
677 'downloadInterval': '1 day(s)', | 677 'downloadInterval': '1 day(s)', |
678 'previousDownload': '2 day(s)', | 678 'previousDownload': '2 day(s)', |
679 'firstInDay': True, | 679 'firstInDay': True, |
680 } | 680 }, |
681 ), | 681 ), |
682 ] | 682 ] |
683 for line, expected_record in tests: | 683 for line, expected_record in tests: |
684 self.assertEqual(logprocessor.parse_record(line, set(), FakeGeo(), F
akeGeo()), expected_record, "Parsing log line '%s'" % line) | 684 self.assertEqual(logprocessor.parse_record(line, set(), FakeGeo(), F
akeGeo()), expected_record, "Parsing log line '%s'" % line) |
685 | 685 |
686 def test_record_adding(self): | 686 def test_record_adding(self): |
687 tests = [ | 687 tests = [ |
688 ( | 688 ( |
689 {'size': 200}, | 689 {'size': 200}, |
690 {}, | 690 {}, |
(...skipping 24 matching lines...) Expand all Loading... |
715 (), | 715 (), |
716 {'hits': 13, 'bandwidth': 230, 'ua': {'Foo': {'hits': 22, 'bandw
idth': 1400}}}, | 716 {'hits': 13, 'bandwidth': 230, 'ua': {'Foo': {'hits': 22, 'bandw
idth': 1400}}}, |
717 ), | 717 ), |
718 ( | 718 ( |
719 {'size': 200, 'ua': 'Foo', 'addonName': 'bar'}, | 719 {'size': 200, 'ua': 'Foo', 'addonName': 'bar'}, |
720 {}, | 720 {}, |
721 (), | 721 (), |
722 { | 722 { |
723 'hits': 1, 'bandwidth': 200, | 723 'hits': 1, 'bandwidth': 200, |
724 'ua': {'Foo': {'hits': 1, 'bandwidth': 200, 'addonName': {'b
ar': {'hits': 1, 'bandwidth': 200}}}}, | 724 'ua': {'Foo': {'hits': 1, 'bandwidth': 200, 'addonName': {'b
ar': {'hits': 1, 'bandwidth': 200}}}}, |
725 'addonName': {'bar': {'hits': 1, 'bandwidth': 200, 'ua': {'F
oo': {'hits': 1, 'bandwidth': 200}}}} | 725 'addonName': {'bar': {'hits': 1, 'bandwidth': 200, 'ua': {'F
oo': {'hits': 1, 'bandwidth': 200}}}}, |
726 }, | 726 }, |
727 ), | 727 ), |
728 ( | 728 ( |
729 {'size': 200, 'ua': 'Foo', 'addonName': 'bar', 'platform': 'xyz'
}, | 729 {'size': 200, 'ua': 'Foo', 'addonName': 'bar', 'platform': 'xyz'
}, |
730 {}, | 730 {}, |
731 ('platform',), | 731 ('platform',), |
732 { | 732 { |
733 'hits': 1, 'bandwidth': 200, | 733 'hits': 1, 'bandwidth': 200, |
734 'ua': {'Foo': {'hits': 1, 'bandwidth': 200}}, | 734 'ua': {'Foo': {'hits': 1, 'bandwidth': 200}}, |
735 'addonName': {'bar': {'hits': 1, 'bandwidth': 200}} | 735 'addonName': {'bar': {'hits': 1, 'bandwidth': 200}}, |
736 }, | 736 }, |
737 ), | 737 ), |
738 ] | 738 ] |
739 for info, section, ignored_fields, expected_result in tests: | 739 for info, section, ignored_fields, expected_result in tests: |
740 logprocessor.add_record(info, section, ignored_fields) | 740 logprocessor.add_record(info, section, ignored_fields) |
741 self.assertEqual(section, expected_result) | 741 self.assertEqual(section, expected_result) |
742 | 742 |
743 | 743 |
744 if __name__ == '__main__': | 744 if __name__ == '__main__': |
745 unittest.main() | 745 unittest.main() |
LEFT | RIGHT |