| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 def test_recordparsing(self): | 312 def test_recordparsing(self): |
| 313 class FakeGeo(object): | 313 class FakeGeo(object): |
| 314 def country_code_by_addr(self, ip): | 314 def country_code_by_addr(self, ip): |
| 315 return "xy" | 315 return "xy" |
| 316 | 316 |
| 317 tests = [ | 317 tests = [ |
| 318 ( | 318 ( |
| 319 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockpluschr
ome/updates.xml?os=mac&arch=x86&nacl_arch=x86-32&prod=chromecrx&prodchannel=stab
le&prodversion=28.0.1500.71&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.
977%26uc HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) A
ppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" "-" htt
ps" "en-US" "downloads.adblockplus.org" "-"', | 319 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockpluschr
ome/updates.xml?os=mac&arch=x86&nacl_arch=x86-32&prod=chromecrx&prodchannel=stab
le&prodversion=28.0.1500.71&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.
977%26uc HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) A
ppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" "-" htt
ps" "en-US" "downloads.adblockplus.org" "-"', |
| 320 { | 320 { |
| 321 "mirror": "mirror123", | |
| 322 "ip": "1.2.3.4", | 321 "ip": "1.2.3.4", |
| 323 "country": "xy", | 322 "country": "xy", |
| 324 "time": datetime(2013, 7, 31, 17, 33, 8), | 323 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 325 "day": 31, | 324 "day": 31, |
| 326 "weekday": 2, | 325 "weekday": 2, |
| 327 "hour": 17, | 326 "hour": 17, |
| 328 "month": "201307", | 327 "month": "201307", |
| 329 "file": "devbuilds/adblockpluschrome/updates.xml", | 328 "file": "devbuilds/adblockpluschrome/updates.xml", |
| 330 "query": "os=mac&arch=x86&nacl_arch=x86-32&prod=chromecrx&prodchannel=
stable&prodversion=28.0.1500.71&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.
5.3.977%26uc", | 329 "query": "os=mac&arch=x86&nacl_arch=x86-32&prod=chromecrx&prodchannel=
stable&prodversion=28.0.1500.71&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.
5.3.977%26uc", |
| 331 "size": 867, | 330 "size": 867, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 349 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomizati
on/update.unknown?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.7
4&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97
384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVer
sion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT 6.1; Wi
n64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "downloads.ad
blockplus.org" "-"', | 348 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomizati
on/update.unknown?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.7
4&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97
384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVer
sion=25.0a1&updateType=97 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Windows NT 6.1; Wi
n64; x64; rv:25.0) Gecko/20130730 Firefox/25.0" "-" https" "en-US" "downloads.ad
blockplus.org" "-"', |
| 350 None | 349 None |
| 351 ), | 350 ), |
| 352 ( | 351 ( |
| 353 '1.2.3.4 corrupted', | 352 '1.2.3.4 corrupted', |
| 354 None | 353 None |
| 355 ), | 354 ), |
| 356 ( | 355 ( |
| 357 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomizati
on/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&ma
xAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVersion
=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" "downloads.adbloc
kplus.org" "-"', | 356 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomizati
on/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&ma
xAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppVersion
=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" "downloads.adbloc
kplus.org" "-"', |
| 358 { | 357 { |
| 359 "mirror": "mirror123", | |
| 360 "ip": "1.2.3.4", | 358 "ip": "1.2.3.4", |
| 361 "country": "xy", | 359 "country": "xy", |
| 362 "time": datetime(2013, 7, 31, 17, 33, 8), | 360 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 363 "day": 31, | 361 "day": 31, |
| 364 "weekday": 2, | 362 "weekday": 2, |
| 365 "hour": 17, | 363 "hour": 17, |
| 366 "month": "201307", | 364 "month": "201307", |
| 367 "file": "devbuilds/abpcustomization/update.rdf", | 365 "file": "devbuilds/abpcustomization/update.rdf", |
| 368 "query": "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a
.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e
97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppV
ersion=25.0a1&updateType=97", | 366 "query": "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a
.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e
97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US¤tAppV
ersion=25.0a1&updateType=97", |
| 369 "size": 867, | 367 "size": 867, |
| 370 "ua": "Firefox", | 368 "ua": "Firefox", |
| 371 "uaversion": "25.0", | 369 "uaversion": "25.0", |
| 372 "fullua": "Firefox 25.0", | 370 "fullua": "Firefox 25.0", |
| 373 "clientid": "-", | 371 "clientid": "-", |
| 374 "addonName": "abpcustomization", | 372 "addonName": "abpcustomization", |
| 375 "addonVersion": "1.0.4a.74", | 373 "addonVersion": "1.0.4a.74", |
| 376 "fullAddon": "abpcustomization 1.0.4a.74", | 374 "fullAddon": "abpcustomization 1.0.4a.74", |
| 377 "application": "firefox", | 375 "application": "firefox", |
| 378 "applicationVersion": "25.0", | 376 "applicationVersion": "25.0", |
| 379 "fullApplication": "firefox 25.0", | 377 "fullApplication": "firefox 25.0", |
| 380 } | 378 } |
| 381 ), | 379 ), |
| 382 ( | 380 ( |
| 383 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplusie/
update.json?addonName=adblockplusie&addonVersion=2.0&application=msie64&applicat
ionVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=0 HTTP/1
.1" 200 867 "-" "Adblock Plus" "-" https" "en-US" "downloads.adblockplus.org" "-
"', | 381 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplusie/
update.json?addonName=adblockplusie&addonVersion=2.0&application=msie64&applicat
ionVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=0 HTTP/1
.1" 200 867 "-" "Adblock Plus" "-" https" "en-US" "downloads.adblockplus.org" "-
"', |
| 384 { | 382 { |
| 385 "mirror": "mirror123", | |
| 386 "ip": "1.2.3.4", | 383 "ip": "1.2.3.4", |
| 387 "country": "xy", | 384 "country": "xy", |
| 388 "time": datetime(2013, 7, 31, 17, 33, 8), | 385 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 389 "day": 31, | 386 "day": 31, |
| 390 "weekday": 2, | 387 "weekday": 2, |
| 391 "hour": 17, | 388 "hour": 17, |
| 392 "month": "201307", | 389 "month": "201307", |
| 393 "file": "devbuilds/adblockplusie/update.json", | 390 "file": "devbuilds/adblockplusie/update.json", |
| 394 "query": "addonName=adblockplusie&addonVersion=2.0&application=msie64&
applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=
0", | 391 "query": "addonName=adblockplusie&addonVersion=2.0&application=msie64&
applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=
0", |
| 395 "size": 867, | 392 "size": 867, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 407 "platformVersion": "1.0", | 404 "platformVersion": "1.0", |
| 408 "fullPlatform": "libadblockplus 1.0", | 405 "fullPlatform": "libadblockplus 1.0", |
| 409 "downloadInterval": "unknown", | 406 "downloadInterval": "unknown", |
| 410 "previousDownload": "unknown", | 407 "previousDownload": "unknown", |
| 411 "firstDownload": True, | 408 "firstDownload": True, |
| 412 } | 409 } |
| 413 ), | 410 ), |
| 414 ( | 411 ( |
| 415 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /adblockplusandroid-1.1.2
.apk HTTP/1.1" 200 49152 "https://adblockplus.org/en/android-install" "Mozilla/5
.0 (Linux; U; Android 4.1.2; es-es; GT-I9100 Build/JZO54K) AppleWebKit/534.30 (K
HTML, like Gecko) Version/4.0 Mobile Safari/534.30" "-" https "en-US" "downloads
.adblockplus.org" "-"', | 412 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /adblockplusandroid-1.1.2
.apk HTTP/1.1" 200 49152 "https://adblockplus.org/en/android-install" "Mozilla/5
.0 (Linux; U; Android 4.1.2; es-es; GT-I9100 Build/JZO54K) AppleWebKit/534.30 (K
HTML, like Gecko) Version/4.0 Mobile Safari/534.30" "-" https "en-US" "downloads
.adblockplus.org" "-"', |
| 416 { | 413 { |
| 417 "mirror": "mirror123", | |
| 418 "ip": "1.2.3.4", | 414 "ip": "1.2.3.4", |
| 419 "country": "xy", | 415 "country": "xy", |
| 420 "time": datetime(2013, 7, 31, 17, 33, 8), | 416 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 421 "day": 31, | 417 "day": 31, |
| 422 "weekday": 2, | 418 "weekday": 2, |
| 423 "hour": 17, | 419 "hour": 17, |
| 424 "month": "201307", | 420 "month": "201307", |
| 425 "file": "adblockplusandroid-1.1.2.apk", | 421 "file": "adblockplusandroid-1.1.2.apk", |
| 426 "query": "", | 422 "query": "", |
| 427 "size": 49152, | 423 "size": 49152, |
| 428 "ua": "Mobile Safari", | 424 "ua": "Mobile Safari", |
| 429 "uaversion": "4.0", | 425 "uaversion": "4.0", |
| 430 "fullua": "Mobile Safari 4.0", | 426 "fullua": "Mobile Safari 4.0", |
| 431 "clientid": "-", | 427 "clientid": "-", |
| 432 "installType": "install", | 428 "installType": "install", |
| 433 } | 429 } |
| 434 ), | 430 ), |
| 435 ( | 431 ( |
| 436 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplus/ad
blockplus-2.3.2.3712.xpi?update HTTP/1.1" 200 827261 "-" "Mozilla/5.0 (Macintosh
; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0" "-" https', | 432 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplus/ad
blockplus-2.3.2.3712.xpi?update HTTP/1.1" 200 827261 "-" "Mozilla/5.0 (Macintosh
; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0" "-" https', |
| 437 { | 433 { |
| 438 "mirror": "mirror123", | |
| 439 "ip": "1.2.3.4", | 434 "ip": "1.2.3.4", |
| 440 "country": "xy", | 435 "country": "xy", |
| 441 "time": datetime(2013, 7, 31, 17, 33, 8), | 436 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 442 "day": 31, | 437 "day": 31, |
| 443 "weekday": 2, | 438 "weekday": 2, |
| 444 "hour": 17, | 439 "hour": 17, |
| 445 "month": "201307", | 440 "month": "201307", |
| 446 "file": "devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi", | 441 "file": "devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi", |
| 447 "query": "update", | 442 "query": "update", |
| 448 "size": 827261, | 443 "size": 827261, |
| 449 "ua": "Firefox", | 444 "ua": "Firefox", |
| 450 "uaversion": "22.0", | 445 "uaversion": "22.0", |
| 451 "fullua": "Firefox 22.0", | 446 "fullua": "Firefox 22.0", |
| 452 "clientid": None, | 447 "clientid": None, |
| 453 "installType": "update", | 448 "installType": "update", |
| 454 } | 449 } |
| 455 ), | 450 ), |
| 456 ( | 451 ( |
| 457 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /exceptionrules.txt?addon
Name=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersion=22.0&
platform=gecko&platformVersion=22.0&lastVersion=201307311503 HTTP/1.1" 200 14303
"-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firef
ox/22.0" "-" https "en-US,en;q=0.5" "easylist-downloads.adblockplus.org" "-"', | 452 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /exceptionrules.txt?addon
Name=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersion=22.0&
platform=gecko&platformVersion=22.0&lastVersion=201307311503 HTTP/1.1" 200 14303
"-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firef
ox/22.0" "-" https "en-US,en;q=0.5" "easylist-downloads.adblockplus.org" "-"', |
| 458 { | 453 { |
| 459 "mirror": "mirror123", | |
| 460 "ip": "1.2.3.4", | 454 "ip": "1.2.3.4", |
| 461 "country": "xy", | 455 "country": "xy", |
| 462 "time": datetime(2013, 7, 31, 17, 33, 8), | 456 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 463 "day": 31, | 457 "day": 31, |
| 464 "weekday": 2, | 458 "weekday": 2, |
| 465 "hour": 17, | 459 "hour": 17, |
| 466 "month": "201307", | 460 "month": "201307", |
| 467 "file": "exceptionrules.txt", | 461 "file": "exceptionrules.txt", |
| 468 "query": "addonName=adblockplus&addonVersion=2.3.2&application=firefox
&applicationVersion=22.0&platform=gecko&platformVersion=22.0&lastVersion=2013073
11503", | 462 "query": "addonName=adblockplus&addonVersion=2.3.2&application=firefox
&applicationVersion=22.0&platform=gecko&platformVersion=22.0&lastVersion=2013073
11503", |
| 469 "size": 14303, | 463 "size": 14303, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 480 "platform": "gecko", | 474 "platform": "gecko", |
| 481 "platformVersion": "22.0", | 475 "platformVersion": "22.0", |
| 482 "fullPlatform": "gecko 22.0", | 476 "fullPlatform": "gecko 22.0", |
| 483 "downloadInterval": "2 hour(s)", | 477 "downloadInterval": "2 hour(s)", |
| 484 "previousDownload": "same day", | 478 "previousDownload": "same day", |
| 485 } | 479 } |
| 486 ), | 480 ), |
| 487 ( | 481 ( |
| 488 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylist.txt?_=137544652
8229 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,nl;q=0.8,
en-US;q=0.6,en;q=0.4" "easylist-downloads.adblockplus.org" "AdBlock/2.6.2"', | 482 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylist.txt?_=137544652
8229 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,nl;q=0.8,
en-US;q=0.6,en;q=0.4" "easylist-downloads.adblockplus.org" "AdBlock/2.6.2"', |
| 489 { | 483 { |
| 490 "mirror": "mirror123", | |
| 491 "ip": "1.2.3.4", | 484 "ip": "1.2.3.4", |
| 492 "country": "xy", | 485 "country": "xy", |
| 493 "time": datetime(2013, 7, 31, 17, 33, 8), | 486 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 494 "day": 31, | 487 "day": 31, |
| 495 "weekday": 2, | 488 "weekday": 2, |
| 496 "hour": 17, | 489 "hour": 17, |
| 497 "month": "201307", | 490 "month": "201307", |
| 498 "file": "easylist.txt", | 491 "file": "easylist.txt", |
| 499 "query": "_=1375446528229", | 492 "query": "_=1375446528229", |
| 500 "size": 326120, | 493 "size": 326120, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 511 "platform": "unknown", | 504 "platform": "unknown", |
| 512 "platformVersion": "unknown", | 505 "platformVersion": "unknown", |
| 513 "fullPlatform": "unknown unknown", | 506 "fullPlatform": "unknown unknown", |
| 514 "downloadInterval": "unknown", | 507 "downloadInterval": "unknown", |
| 515 "previousDownload": "unknown", | 508 "previousDownload": "unknown", |
| 516 } | 509 } |
| 517 ), | 510 ), |
| 518 ( | 511 ( |
| 519 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.txt HTTP/1
.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"', | 512 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.txt HTTP/1
.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"', |
| 520 { | 513 { |
| 521 "mirror": "mirror123", | |
| 522 "ip": "1.2.3.4", | 514 "ip": "1.2.3.4", |
| 523 "country": "xy", | 515 "country": "xy", |
| 524 "time": datetime(2013, 7, 31, 17, 33, 8), | 516 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 525 "day": 31, | 517 "day": 31, |
| 526 "weekday": 2, | 518 "weekday": 2, |
| 527 "hour": 17, | 519 "hour": 17, |
| 528 "month": "201307", | 520 "month": "201307", |
| 529 "file": "easylistitaly.txt", | 521 "file": "easylistitaly.txt", |
| 530 "query": "", | 522 "query": "", |
| 531 "size": 85879, | 523 "size": 85879, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 542 "platform": "unknown", | 534 "platform": "unknown", |
| 543 "platformVersion": "unknown", | 535 "platformVersion": "unknown", |
| 544 "fullPlatform": "unknown unknown", | 536 "fullPlatform": "unknown unknown", |
| 545 "downloadInterval": "unknown", | 537 "downloadInterval": "unknown", |
| 546 "previousDownload": "unknown", | 538 "previousDownload": "unknown", |
| 547 } | 539 } |
| 548 ), | 540 ), |
| 549 ( | 541 ( |
| 550 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tpl HTTP/1
.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"', | 542 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tpl HTTP/1
.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"', |
| 551 { | 543 { |
| 552 "mirror": "mirror123", | |
| 553 "ip": "1.2.3.4", | 544 "ip": "1.2.3.4", |
| 554 "country": "xy", | 545 "country": "xy", |
| 555 "time": datetime(2013, 7, 31, 17, 33, 8), | 546 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 556 "day": 31, | 547 "day": 31, |
| 557 "weekday": 2, | 548 "weekday": 2, |
| 558 "hour": 17, | 549 "hour": 17, |
| 559 "month": "201307", | 550 "month": "201307", |
| 560 "file": "easylistitaly.tpl", | 551 "file": "easylistitaly.tpl", |
| 561 "query": "", | 552 "query": "", |
| 562 "size": 85879, | 553 "size": 85879, |
| 563 "ua": "Other", | 554 "ua": "Other", |
| 564 "uaversion": "", | 555 "uaversion": "", |
| 565 "fullua": "Other ", | 556 "fullua": "Other ", |
| 566 "clientid": "-", | 557 "clientid": "-", |
| 567 } | 558 } |
| 568 ), | 559 ), |
| 569 ( | 560 ( |
| 570 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /notification.json?addonN
ame=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationVersion=2
8.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=201307292
310 HTTP/1.1" 200 299 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTM
L, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https', | 561 '1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /notification.json?addonN
ame=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationVersion=2
8.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=201307292
310 HTTP/1.1" 200 299 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTM
L, like Gecko) Chrome/28.0.1500.72 Safari/537.36" "-" https', |
| 571 { | 562 { |
| 572 "mirror": "mirror123", | |
| 573 "ip": "1.2.3.4", | 563 "ip": "1.2.3.4", |
| 574 "country": "xy", | 564 "country": "xy", |
| 575 "time": datetime(2013, 7, 31, 17, 33, 8), | 565 "time": datetime(2013, 7, 31, 17, 33, 8), |
| 576 "day": 31, | 566 "day": 31, |
| 577 "weekday": 2, | 567 "weekday": 2, |
| 578 "hour": 17, | 568 "hour": 17, |
| 579 "month": "201307", | 569 "month": "201307", |
| 580 "file": "notification.json", | 570 "file": "notification.json", |
| 581 "query": "addonName=adblockpluschrome&addonVersion=1.5.3&application=c
hrome&applicationVersion=28.0.1500.72&platform=chromium&platformVersion=28.0.150
0.72&lastVersion=201307292310", | 571 "query": "addonName=adblockpluschrome&addonVersion=1.5.3&application=c
hrome&applicationVersion=28.0.1500.72&platform=chromium&platformVersion=28.0.150
0.72&lastVersion=201307292310", |
| 582 "size": 299, | 572 "size": 299, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 593 "platform": "chromium", | 583 "platform": "chromium", |
| 594 "platformVersion": "28.0", | 584 "platformVersion": "28.0", |
| 595 "fullPlatform": "chromium 28.0", | 585 "fullPlatform": "chromium 28.0", |
| 596 "downloadInterval": "1 day(s)", | 586 "downloadInterval": "1 day(s)", |
| 597 "previousDownload": "2 day(s)", | 587 "previousDownload": "2 day(s)", |
| 598 "firstInDay": True, | 588 "firstInDay": True, |
| 599 } | 589 } |
| 600 ), | 590 ), |
| 601 ] | 591 ] |
| 602 for line, expected_record in tests: | 592 for line, expected_record in tests: |
| 603 logprocessor.mirror_name = "mirror123" | |
| 604 self.assertEqual(logprocessor.parse_record(line, set(), FakeGeo(), FakeGeo
()), expected_record, "Parsing log line '%s'" % line) | 593 self.assertEqual(logprocessor.parse_record(line, set(), FakeGeo(), FakeGeo
()), expected_record, "Parsing log line '%s'" % line) |
| 605 | 594 |
| 606 def test_record_adding(self): | 595 def test_record_adding(self): |
| 607 tests = [ | 596 tests = [ |
| 608 ( | 597 ( |
| 609 {"size": 200}, | 598 {"size": 200}, |
| 610 {}, | 599 {}, |
| 611 (), | 600 (), |
| 612 {"hits": 1, "bandwidth": 200}, | 601 {"hits": 1, "bandwidth": 200}, |
| 613 ), | 602 ), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 "addonName": {"bar": {"hits": 1, "bandwidth": 200}} | 644 "addonName": {"bar": {"hits": 1, "bandwidth": 200}} |
| 656 }, | 645 }, |
| 657 ), | 646 ), |
| 658 ] | 647 ] |
| 659 for info, section, ignored_fields, expected_result in tests: | 648 for info, section, ignored_fields, expected_result in tests: |
| 660 logprocessor.add_record(info, section, ignored_fields) | 649 logprocessor.add_record(info, section, ignored_fields) |
| 661 self.assertEqual(section, expected_result) | 650 self.assertEqual(section, expected_result) |
| 662 | 651 |
| 663 if __name__ == '__main__': | 652 if __name__ == '__main__': |
| 664 unittest.main() | 653 unittest.main() |
| OLD | NEW |