Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/stats/test/logprocessor.py

Issue 29345242: Noissue - Adapt quotes for compliance with our coding style in sitescripts (Closed)
Patch Set: Fixed raw string Created May 30, 2016, 8:47 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/stats/test/logprocessor.py
===================================================================
--- a/sitescripts/stats/test/logprocessor.py
+++ b/sitescripts/stats/test/logprocessor.py
@@ -24,41 +24,41 @@
def test_uaparsing(self):
tests = [
- ("Firefox", "25.0", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0"),
- ("Firefox", "25.0", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:28.0) Gecko/20130730 Firefox/25.0"),
- ("Firefox", "25.0", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0.1) Gecko/20130730 Firefox/25.0.1"),
- ("Firefox Mobile", "15.0", "Mozilla/5.0 (Maemo; Mobile; rv:15.0) Gecko/20120829 Firefox/15.0 Fennec/15.0"),
- ("Firefox Mobile", "14.0", "Mozilla/5.0 (Android; Mobile; rv:14.0) Gecko/14.0 Firefox/14.0a2"),
- ("Firefox Tablet", "26.0", "Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0"),
- ("Thunderbird", "24.0", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0a2 Lightning/2.6a2"),
- ("SeaMonkey", "2.19", "Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19"),
- ("K-Meleon", "1.5", "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru-RU; rv:1.8.1.24pre) Gecko/20100228 K-Meleon/1.5.4"),
- ("Prism", "1.0", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.20) Gecko/20110803 Prism/1.0b4"),
- ("Gecko", "22.0", "Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 FooBar/1.0"),
- ("Opera", "11.10", "Opera/9.80 (Android; Opera Mini/15.0.1162/30.3558; U; it) Presto/2.8.119 Version/11.10"),
- ("Opera", "9.80", "Opera/9.80 (Android; Opera Mini/15.0.1162/30.3558; U; it) Presto/2.8.119"),
- ("Opera", "15.0", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36 OPR/15.0.1147.148"),
- ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"),
- ("Chrome", "28.0", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Iron/28.0.1550.0 Chrome/28.0.1550.0 Safari/537.36"),
- ("Safari", "5.0", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"),
- ("Mobile Safari", "4.0", "Mozilla/5.0 (Linux; U; Android 4.0.4; pt-br; LG-E400 Build/IMM76L; CyanogenMod-9) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"),
- ("CoolNovo", "2.0.9", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36 CoolNovo/2.0.9.11"),
- ("WebKit", "", "Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; P7 Build/JRO03C) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.2.0.308 U3/0.8.0 Mobile Safari/534.31"),
- ("MSIE", "10.0", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"),
- ("MSIE", "7.0", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)"),
- ("MSIE", "11.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch; rv:11.0) like Gecko"),
- ("Trident", "7.0", "Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch) like Gecko"),
- ("Edge", "12", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"),
- ("Edge", "12", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136"),
- ("Edge", "12", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.36 (KHTML, like Gecko) Edge/12.10240"),
- ("Edge", "12", "Mozilla/5.0 (Windows NT 6.3; Win64, x64; Touch) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0 (Touch; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; HPNTDFJS; H9P; InfoPath"),
- ("Android", "", "AndroidDownloadManager"),
- ("Android", "4.1", "AndroidDownloadManager/4.1.1 (Linux; U; Android 4.1.1; A210 Build/JRO03H)"),
- ("Android", "4.0", "Dalvik/1.6.0 (Linux; U; Android 4.0.3; KFOT Build/IML74K)"),
- ("Android", "4.3", "Dalvik/1.6.0 (Linux; U; Android 4.3; Nexus 7 Build/JSS15J)"),
- ("Android", "", "Apache-HttpClient/UNAVAILABLE (java 1.4)"),
- ("ABP", "", "Adblock Plus"),
- ("Other", "", "-"),
+ ('Firefox', '25.0', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20130730 Firefox/25.0'),
+ ('Firefox', '25.0', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:28.0) Gecko/20130730 Firefox/25.0'),
+ ('Firefox', '25.0', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0.1) Gecko/20130730 Firefox/25.0.1'),
+ ('Firefox Mobile', '15.0', 'Mozilla/5.0 (Maemo; Mobile; rv:15.0) Gecko/20120829 Firefox/15.0 Fennec/15.0'),
+ ('Firefox Mobile', '14.0', 'Mozilla/5.0 (Android; Mobile; rv:14.0) Gecko/14.0 Firefox/14.0a2'),
+ ('Firefox Tablet', '26.0', 'Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0'),
+ ('Thunderbird', '24.0', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0a2 Lightning/2.6a2'),
+ ('SeaMonkey', '2.19', 'Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19'),
+ ('K-Meleon', '1.5', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru-RU; rv:1.8.1.24pre) Gecko/20100228 K-Meleon/1.5.4'),
+ ('Prism', '1.0', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.20) Gecko/20110803 Prism/1.0b4'),
+ ('Gecko', '22.0', 'Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 FooBar/1.0'),
+ ('Opera', '11.10', 'Opera/9.80 (Android; Opera Mini/15.0.1162/30.3558; U; it) Presto/2.8.119 Version/11.10'),
+ ('Opera', '9.80', 'Opera/9.80 (Android; Opera Mini/15.0.1162/30.3558; U; it) Presto/2.8.119'),
+ ('Opera', '15.0', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36 OPR/15.0.1147.148'),
+ ('Chrome', '28.0', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36'),
+ ('Chrome', '28.0', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Iron/28.0.1550.0 Chrome/28.0.1550.0 Safari/537.36'),
+ ('Safari', '5.0', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16'),
+ ('Mobile Safari', '4.0', 'Mozilla/5.0 (Linux; U; Android 4.0.4; pt-br; LG-E400 Build/IMM76L; CyanogenMod-9) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'),
+ ('CoolNovo', '2.0.9', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36 CoolNovo/2.0.9.11'),
+ ('WebKit', '', 'Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; P7 Build/JRO03C) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.2.0.308 U3/0.8.0 Mobile Safari/534.31'),
+ ('MSIE', '10.0', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'),
+ ('MSIE', '7.0', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)'),
+ ('MSIE', '11.0', 'Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch; rv:11.0) like Gecko'),
+ ('Trident', '7.0', 'Mozilla/5.0 (Windows NT 6.3; ARM; Trident/7.0; Touch) like Gecko'),
+ ('Edge', '12', 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'),
+ ('Edge', '12', 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136'),
+ ('Edge', '12', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.36 (KHTML, like Gecko) Edge/12.10240'),
+ ('Edge', '12', 'Mozilla/5.0 (Windows NT 6.3; Win64, x64; Touch) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0 (Touch; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; HPNTDFJS; H9P; InfoPath'),
+ ('Android', '', 'AndroidDownloadManager'),
+ ('Android', '4.1', 'AndroidDownloadManager/4.1.1 (Linux; U; Android 4.1.1; A210 Build/JRO03H)'),
+ ('Android', '4.0', 'Dalvik/1.6.0 (Linux; U; Android 4.0.3; KFOT Build/IML74K)'),
+ ('Android', '4.3', 'Dalvik/1.6.0 (Linux; U; Android 4.3; Nexus 7 Build/JSS15J)'),
+ ('Android', '', 'Apache-HttpClient/UNAVAILABLE (java 1.4)'),
+ ('ABP', '', 'Adblock Plus'),
+ ('Other', '', '-'),
]
for expected_browser, expected_version, ua in tests:
self.assertEqual(logprocessor.parse_ua(ua), (expected_browser, expected_version), "Parsing user agent '%s'" % ua)
@@ -74,19 +74,19 @@
return country
tests = [
- ("1.2.3.4", "xy", "1.2.3.4", "v4", "xy"),
- ("::ffff:1.2.3.4", "xy", "1.2.3.4", "v4", "xy"),
- ("1.2.3.4", "--", "1.2.3.4", "v4", "unknown"),
- ("1.2.3.4", "", "1.2.3.4", "v4", "unknown"),
- ("::ffff:1.2.3.4", None, "1.2.3.4", "v4", "unknown"),
- ("::1", "xy", "::1", "v6", "xy"),
- ("FE80:0000:0000:0000:0202:B3FF:FE1E:8329", None, "FE80:0000:0000:0000:0202:B3FF:FE1E:8329", "v6", "unknown"),
+ ('1.2.3.4', 'xy', '1.2.3.4', 'v4', 'xy'),
+ ('::ffff:1.2.3.4', 'xy', '1.2.3.4', 'v4', 'xy'),
+ ('1.2.3.4', '--', '1.2.3.4', 'v4', 'unknown'),
+ ('1.2.3.4', '', '1.2.3.4', 'v4', 'unknown'),
+ ('::ffff:1.2.3.4', None, '1.2.3.4', 'v4', 'unknown'),
+ ('::1', 'xy', '::1', 'v6', 'xy'),
+ ('FE80:0000:0000:0000:0202:B3FF:FE1E:8329', None, 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329', 'v6', 'unknown'),
]
for ip, country, expected_ip, expected_type, expected_country in tests:
fake_geo = FakeGeo()
fake_geov6 = FakeGeo()
self.assertEqual(logprocessor.process_ip(ip, fake_geo, fake_geov6), (expected_ip, expected_country), "Processing IP '%s'" % ip)
- if expected_type == "v4":
+ if expected_type == 'v4':
self.assertEqual(fake_geo.ip_checked, expected_ip, "GeoIP check for IP '%s'" % ip)
self.assertEqual(fake_geov6.ip_checked, None, "GeoIPv6 check for IP '%s'" % ip)
else:
@@ -95,11 +95,11 @@
def test_timeparsing(self):
tests = [
- ("31/Jul/2013:12:03:37", 0, 0, datetime(2013, 07, 31, 12, 03, 37), "201307"),
- ("31/Jul/2013:12:03:37", 5, 0, datetime(2013, 07, 31, 7, 03, 37), "201307"),
- ("31/Jul/2013:12:03:37", -5, 0, datetime(2013, 07, 31, 17, 03, 37), "201307"),
- ("31/Jul/2013:12:03:37", 5, 30, datetime(2013, 07, 31, 6, 33, 37), "201307"),
- ("31/Jul/2013:12:03:37", -5, 30, datetime(2013, 07, 31, 17, 33, 37), "201307"),
+ ('31/Jul/2013:12:03:37', 0, 0, datetime(2013, 07, 31, 12, 03, 37), '201307'),
+ ('31/Jul/2013:12:03:37', 5, 0, datetime(2013, 07, 31, 7, 03, 37), '201307'),
+ ('31/Jul/2013:12:03:37', -5, 0, datetime(2013, 07, 31, 17, 03, 37), '201307'),
+ ('31/Jul/2013:12:03:37', 5, 30, datetime(2013, 07, 31, 6, 33, 37), '201307'),
+ ('31/Jul/2013:12:03:37', -5, 30, datetime(2013, 07, 31, 17, 33, 37), '201307'),
]
for timestr, tz_hours, tz_minutes, expected_time, expected_month in tests:
self.assertEqual(logprocessor.parse_time(timestr, tz_hours, tz_minutes),
@@ -108,15 +108,15 @@
def test_pathparsing(self):
tests = [
- ("/foo.txt", "foo.txt", ""),
- ("/foo.txt?", "foo.txt", ""),
- ("/foo.txt?asdf", "foo.txt", "asdf"),
- ("http://example.com/foo.txt", "foo.txt", ""),
- ("/xyz/foo.txt?asdf", "xyz/foo.txt", "asdf"),
- ("/xyz/foo+bar.txt?asdf", "xyz/foo+bar.txt", "asdf"),
- ("/xyz/foo%2Bbar%2etxt?asdf", "xyz/foo+bar.txt", "asdf"),
- ("/xyz/%D1%82%D0%B5%D1%81%D1%82.txt", u"xyz/\u0442\u0435\u0441\u0442.txt", ""),
- ("/xyz/foo%8Cbar.txt?asdf", "xyz/foo%8Cbar.txt", "asdf"),
+ ('/foo.txt', 'foo.txt', ''),
+ ('/foo.txt?', 'foo.txt', ''),
+ ('/foo.txt?asdf', 'foo.txt', 'asdf'),
+ ('http://example.com/foo.txt', 'foo.txt', ''),
+ ('/xyz/foo.txt?asdf', 'xyz/foo.txt', 'asdf'),
+ ('/xyz/foo+bar.txt?asdf', 'xyz/foo+bar.txt', 'asdf'),
+ ('/xyz/foo%2Bbar%2etxt?asdf', 'xyz/foo+bar.txt', 'asdf'),
+ ('/xyz/%D1%82%D0%B5%D1%81%D1%82.txt', u'xyz/\u0442\u0435\u0441\u0442.txt', ''),
+ ('/xyz/foo%8Cbar.txt?asdf', 'xyz/foo%8Cbar.txt', 'asdf'),
]
for path, expected_file, expected_query in tests:
self.assertEqual(logprocessor.parse_path(path), (expected_file, expected_query), "Parsing path '%s'" % path)
@@ -125,157 +125,157 @@
tests = [
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "",
- "",
- "unknown/unknown",
- "unknown/unknown",
- "unknown/unknown",
- "unknown",
- "unknown",
- "",
+ 'easylist.txt',
+ '',
+ '',
+ 'unknown/unknown',
+ 'unknown/unknown',
+ 'unknown/unknown',
+ 'unknown',
+ 'unknown',
+ '',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&application=firefox&applicationVersion=22.0a1&platform=gecko&platformVersion=23.0&lastVersion=0",
- "-",
- "adblockplus/2.3.1",
- "firefox/22.0",
- "gecko/23.0",
- "unknown",
- "unknown",
- "firstDownload",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&application=firefox&applicationVersion=22.0a1&platform=gecko&platformVersion=23.0&lastVersion=0',
+ '-',
+ 'adblockplus/2.3.1',
+ 'firefox/22.0',
+ 'gecko/23.0',
+ 'unknown',
+ 'unknown',
+ 'firstDownload',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307311200-1/0",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "0 hour(s)",
- "same day",
- "",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307311200-1/0',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '0 hour(s)',
+ 'same day',
+ '',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307302200-1/3",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "14 hour(s)",
- "1 day(s)",
- "firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307302200-1/3',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '14 hour(s)',
+ '1 day(s)',
+ 'firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307282200",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "2 day(s)",
- "3 day(s)",
- "firstInWeek firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307282200',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '2 day(s)',
+ '3 day(s)',
+ 'firstInWeek firstInDay',
),
(
datetime(2013, 8, 2, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307311200",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "2 day(s)",
- "2 day(s)",
- "firstInMonth firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201307311200',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '2 day(s)',
+ '2 day(s)',
+ 'firstInMonth firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201306302200",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "1 month(s)",
- "1 month(s)",
- "firstInMonth firstInWeek firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201306302200',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '1 month(s)',
+ '1 month(s)',
+ 'firstInMonth firstInWeek firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201305302200",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "2 month(s)",
- "2 month(s)",
- "firstInMonth firstInWeek firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0&lastVersion=201305302200',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '2 month(s)',
+ '2 month(s)',
+ 'firstInMonth firstInWeek firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0.1&lastVersion=201206302200",
- "-",
- "adblockplus/2.3.1",
- "unknown/unknown",
- "gecko/23.0",
- "1 year(s)",
- "1 year(s)",
- "firstInMonth firstInWeek firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockplus&addonVersion=2.3.1&platform=gecko&platformVersion=23.0.1&lastVersion=201206302200',
+ '-',
+ 'adblockplus/2.3.1',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '1 year(s)',
+ '1 year(s)',
+ 'firstInMonth firstInWeek firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "addonName=adblockedge&addonVersion=2.1.2&platform=gecko&platformVersion=23.0.1&lastVersion=201206302200",
- "-",
- "adblockedge/2.1.2",
- "unknown/unknown",
- "gecko/23.0",
- "1 year(s)",
- "unknown",
- "firstInMonth firstInWeek firstInDay",
+ 'easylist.txt',
+ 'addonName=adblockedge&addonVersion=2.1.2&platform=gecko&platformVersion=23.0.1&lastVersion=201206302200',
+ '-',
+ 'adblockedge/2.1.2',
+ 'unknown/unknown',
+ 'gecko/23.0',
+ '1 year(s)',
+ 'unknown',
+ 'firstInMonth firstInWeek firstInDay',
),
(
datetime(2013, 07, 31, 12, 03, 00),
- "easylist.txt",
- "_=1375142394357",
- "AdBlock/2.5.4",
- "chromeadblock/2.5.4",
- "unknown/unknown",
- "unknown/unknown",
- "unknown",
- "unknown",
- ""
+ 'easylist.txt',
+ '_=1375142394357',
+ 'AdBlock/2.5.4',
+ 'chromeadblock/2.5.4',
+ 'unknown/unknown',
+ 'unknown/unknown',
+ 'unknown',
+ 'unknown',
+ ''
),
]
for time, file, query, clientid, expected_addon, expected_application, expected_platform, expected_interval, expected_previous, expected_flags in tests:
- info = {"time": time, "file": file, "query": query, "clientid": clientid}
+ info = {'time': time, 'file': file, 'query': query, 'clientid': clientid}
logprocessor.parse_downloader_query(info)
- self.assertEqual("%s/%s" % (info["addonName"], info["addonVersion"]), expected_addon, "Add-on for query '%s'" % query)
- self.assertEqual("%s/%s" % (info["application"], info["applicationVersion"]), expected_application, "Application for query '%s'" % query)
- self.assertEqual("%s/%s" % (info["platform"], info["platformVersion"]), expected_platform, "Platform for query '%s'" % query)
- self.assertEqual(info["downloadInterval"], expected_interval, "Download interval for query '%s'" % query)
- self.assertEqual(info["previousDownload"], expected_previous, "Previous download for query '%s'" % query)
+ self.assertEqual('%s/%s' % (info['addonName'], info['addonVersion']), expected_addon, "Add-on for query '%s'" % query)
+ self.assertEqual('%s/%s' % (info['application'], info['applicationVersion']), expected_application, "Application for query '%s'" % query)
+ self.assertEqual('%s/%s' % (info['platform'], info['platformVersion']), expected_platform, "Platform for query '%s'" % query)
+ self.assertEqual(info['downloadInterval'], expected_interval, "Download interval for query '%s'" % query)
+ self.assertEqual(info['previousDownload'], expected_previous, "Previous download for query '%s'" % query)
flags = []
- for flag in ("firstDownload", "firstInMonth", "firstInWeek", "firstInDay"):
+ for flag in ('firstDownload', 'firstInMonth', 'firstInWeek', 'firstInDay'):
if flag in info:
flags.append(flag)
- self.assertEqual(" ".join(flags), expected_flags, "Flags for query '%s'" % query)
+ self.assertEqual(' '.join(flags), expected_flags, "Flags for query '%s'" % query)
def test_nameparsing(self):
tests = [
- ("devbuilds/adblockplus/update.rdf", "adblockplus"),
- ("adblockpluschrome-experimental/updates.xml", "adblockpluschrome-experimental"),
- ("update.json", None),
+ ('devbuilds/adblockplus/update.rdf', 'adblockplus'),
+ ('adblockpluschrome-experimental/updates.xml', 'adblockpluschrome-experimental'),
+ ('update.json', None),
]
for file, expected_name in tests:
self.assertEqual(logprocessor.parse_addon_name(file), expected_name, "Getting add-on name for file '%s'" % file)
@@ -283,16 +283,16 @@
def test_geckoqueryparsing(self):
tests = [
(
- "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&currentAppVersion=22.0&updateType=112",
- "2.3.1.3707", "firefox", "22.0"
+ '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&currentAppVersion=22.0&updateType=112',
+ '2.3.1.3707', 'firefox', '22.0'
),
(
- "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97",
- "1.0.4a.74", "firefox", "25.0"
+ 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97',
+ '1.0.4a.74', 'firefox', '25.0'
),
(
- "reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=1.3a.20100925&maxAppVersion=2.1b1&status=userEnabled,incompatible&appID={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}&appVersion=2.19&appOS=WINNT&appABI=x86-msvc&locale=en-US&currentAppVersion=2.19&updateType=112",
- "1.3a.20100925", "seamonkey", "2.19"
+ 'reqVersion=2&id={d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}&version=1.3a.20100925&maxAppVersion=2.1b1&status=userEnabled,incompatible&appID={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}&appVersion=2.19&appOS=WINNT&appABI=x86-msvc&locale=en-US&currentAppVersion=2.19&updateType=112',
+ '1.3a.20100925', 'seamonkey', '2.19'
),
]
for query, expected_version, expected_application, expected_applicationversion in tests:
@@ -301,16 +301,16 @@
def test_chromequeryparsing(self):
tests = [
(
- "os=win&arch=x86&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=28.0.1500.72&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc",
- "1.5.3.977", "chrome", "28.0"
+ 'os=win&arch=x86&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=28.0.1500.72&x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc',
+ '1.5.3.977', 'chrome', '28.0'
),
(
- "x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc",
- "1.5.3.977", "unknown", "unknown"
+ 'x=id%3Dldcecbkkoecffmfljeihcmifjjdoepkn%26v%3D1.5.3.977%26uc',
+ '1.5.3.977', 'unknown', 'unknown'
),
(
- "api=15&build=256&locale=ru_ru&device=LGE%20LG-P990",
- "unknown", "unknown", "unknown"
+ 'api=15&build=256&locale=ru_ru&device=LGE%20LG-P990',
+ 'unknown', 'unknown', 'unknown'
),
]
for query, expected_version, expected_application, expected_applicationversion in tests:
@@ -318,10 +318,10 @@
def test_updateflagparsing(self):
tests = [
- ("update", "update"),
- ("", "install"),
- ("foo", "install"),
- ("update&foo", "install"),
+ ('update', 'update'),
+ ('', 'install'),
+ ('foo', 'install'),
+ ('update&foo', 'install'),
]
for query, expected_result in tests:
self.assertEqual(logprocessor.parse_update_flag(query), expected_result, "Checking update flag for query '%s'" % query)
@@ -329,34 +329,34 @@
def test_recordparsing(self):
class FakeGeo(object):
def country_code_by_addr(self, ip):
- return "xy"
+ return 'xy'
tests = [
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockpluschrome/updates.xml?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 HTTP/1.1" 200 867 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" "-" https" "en-US" "downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/adblockpluschrome/updates.xml",
- "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",
- "size": 867,
- "referrer": "-",
- "status": 200,
- "ua": "Chrome",
- "uaversion": "28.0",
- "fullua": "Chrome 28.0",
- "clientid": "-",
- "addonName": "adblockpluschrome",
- "addonVersion": "1.5.3.977",
- "fullAddon": "adblockpluschrome 1.5.3.977",
- "application": "chrome",
- "applicationVersion": "28.0",
- "fullApplication": "chrome 28.0",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/adblockpluschrome/updates.xml',
+ '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',
+ 'size': 867,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Chrome',
+ 'uaversion': '28.0',
+ 'fullua': 'Chrome 28.0',
+ 'clientid': '-',
+ 'addonName': 'adblockpluschrome',
+ 'addonVersion': '1.5.3.977',
+ 'fullAddon': 'adblockpluschrome 1.5.3.977',
+ 'application': 'chrome',
+ 'applicationVersion': '28.0',
+ 'fullApplication': 'chrome 28.0',
}
),
(
@@ -366,55 +366,55 @@
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=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" "downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/abpcustomization/update.rdf",
- "query": "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97",
- "size": 867,
- "referrer": "-",
- "status": 301,
- "ua": "Firefox",
- "uaversion": "25.0",
- "fullua": "Firefox 25.0",
- "clientid": "-",
- "addonName": "abpcustomization",
- "addonVersion": "1.0.4a.74",
- "fullAddon": "abpcustomization 1.0.4a.74",
- "application": "firefox",
- "applicationVersion": "25.0",
- "fullApplication": "firefox 25.0",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/abpcustomization/update.rdf',
+ 'query': 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97',
+ 'size': 867,
+ 'referrer': '-',
+ 'status': 301,
+ 'ua': 'Firefox',
+ 'uaversion': '25.0',
+ 'fullua': 'Firefox 25.0',
+ 'clientid': '-',
+ 'addonName': 'abpcustomization',
+ 'addonVersion': '1.0.4a.74',
+ 'fullAddon': 'abpcustomization 1.0.4a.74',
+ 'application': 'firefox',
+ 'applicationVersion': '25.0',
+ 'fullApplication': 'firefox 25.0',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=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" "downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/abpcustomization/update.rdf",
- "query": "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97",
- "size": 867,
- "referrer": "-",
- "status": 302,
- "ua": "Firefox",
- "uaversion": "25.0",
- "fullua": "Firefox 25.0",
- "clientid": "-",
- "addonName": "abpcustomization",
- "addonVersion": "1.0.4a.74",
- "fullAddon": "abpcustomization 1.0.4a.74",
- "application": "firefox",
- "applicationVersion": "25.0",
- "fullApplication": "firefox 25.0",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/abpcustomization/update.rdf',
+ 'query': 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97',
+ 'size': 867,
+ 'referrer': '-',
+ 'status': 302,
+ 'ua': 'Firefox',
+ 'uaversion': '25.0',
+ 'fullua': 'Firefox 25.0',
+ 'clientid': '-',
+ 'addonName': 'abpcustomization',
+ 'addonVersion': '1.0.4a.74',
+ 'fullAddon': 'abpcustomization 1.0.4a.74',
+ 'application': 'firefox',
+ 'applicationVersion': '25.0',
+ 'fullApplication': 'firefox 25.0',
}
),
(
@@ -428,255 +428,255 @@
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/abpcustomization/update.rdf?reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=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.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/abpcustomization/update.rdf",
- "query": "reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97",
- "size": 867,
- "referrer": "-",
- "status": 200,
- "ua": "Firefox",
- "uaversion": "25.0",
- "fullua": "Firefox 25.0",
- "clientid": "-",
- "addonName": "abpcustomization",
- "addonVersion": "1.0.4a.74",
- "fullAddon": "abpcustomization 1.0.4a.74",
- "application": "firefox",
- "applicationVersion": "25.0",
- "fullApplication": "firefox 25.0",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/abpcustomization/update.rdf',
+ 'query': 'reqVersion=2&id=customization@adblockplus.org&version=1.0.4a.74&maxAppVersion=26.0&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=25.0a1&appOS=WINNT&appABI=x86_64-msvc&locale=en-US&currentAppVersion=25.0a1&updateType=97',
+ 'size': 867,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Firefox',
+ 'uaversion': '25.0',
+ 'fullua': 'Firefox 25.0',
+ 'clientid': '-',
+ 'addonName': 'abpcustomization',
+ 'addonVersion': '1.0.4a.74',
+ 'fullAddon': 'abpcustomization 1.0.4a.74',
+ 'application': 'firefox',
+ 'applicationVersion': '25.0',
+ 'fullApplication': 'firefox 25.0',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplusie/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" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/adblockplusie/update.json",
- "query": "addonName=adblockplusie&addonVersion=2.0&application=msie64&applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=0",
- "size": 867,
- "referrer": "-",
- "status": 200,
- "ua": "ABP",
- "uaversion": "",
- "fullua": "ABP ",
- "clientid": "-",
- "addonName": "adblockplusie",
- "addonVersion": "2.0",
- "fullAddon": "adblockplusie 2.0",
- "application": "msie64",
- "applicationVersion": "10.0",
- "fullApplication": "msie64 10.0",
- "platform": "libadblockplus",
- "platformVersion": "1.0",
- "fullPlatform": "libadblockplus 1.0",
- "downloadInterval": "unknown",
- "previousDownload": "unknown",
- "firstDownload": True,
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/adblockplusie/update.json',
+ 'query': 'addonName=adblockplusie&addonVersion=2.0&application=msie64&applicationVersion=10.0&platform=libadblockplus&platformVersion=1.0&lastVersion=0',
+ 'size': 867,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'ABP',
+ 'uaversion': '',
+ 'fullua': 'ABP ',
+ 'clientid': '-',
+ 'addonName': 'adblockplusie',
+ 'addonVersion': '2.0',
+ 'fullAddon': 'adblockplusie 2.0',
+ 'application': 'msie64',
+ 'applicationVersion': '10.0',
+ 'fullApplication': 'msie64 10.0',
+ 'platform': 'libadblockplus',
+ 'platformVersion': '1.0',
+ 'fullPlatform': 'libadblockplus 1.0',
+ 'downloadInterval': 'unknown',
+ 'previousDownload': 'unknown',
+ 'firstDownload': True,
}
),
(
'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 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30" "-" https "en-US" "downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "adblockplusandroid-1.1.2.apk",
- "query": "",
- "size": 49152,
- "referrer": "https://adblockplus.org/en/android-install",
- "status": 200,
- "ua": "Mobile Safari",
- "uaversion": "4.0",
- "fullua": "Mobile Safari 4.0",
- "clientid": "-",
- "installType": "install",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'adblockplusandroid-1.1.2.apk',
+ 'query': '',
+ 'size': 49152,
+ 'referrer': 'https://adblockplus.org/en/android-install',
+ 'status': 200,
+ 'ua': 'Mobile Safari',
+ 'uaversion': '4.0',
+ 'fullua': 'Mobile Safari 4.0',
+ 'clientid': '-',
+ 'installType': 'install',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /devbuilds/adblockplus/adblockplus-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',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi",
- "query": "update",
- "size": 827261,
- "referrer": "-",
- "status": 200,
- "ua": "Firefox",
- "uaversion": "22.0",
- "fullua": "Firefox 22.0",
- "clientid": None,
- "installType": "update",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'devbuilds/adblockplus/adblockplus-2.3.2.3712.xpi',
+ 'query': 'update',
+ 'size': 827261,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Firefox',
+ 'uaversion': '22.0',
+ 'fullua': 'Firefox 22.0',
+ 'clientid': None,
+ 'installType': 'update',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /exceptionrules.txt?addonName=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 Firefox/22.0" "-" https "en-US,en;q=0.5" "easylist-downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "exceptionrules.txt",
- "query": "addonName=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersion=22.0&platform=gecko&platformVersion=22.0&lastVersion=201307311503",
- "size": 14303,
- "referrer": "-",
- "status": 200,
- "ua": "Firefox",
- "uaversion": "22.0",
- "fullua": "Firefox 22.0",
- "clientid": "-",
- "addonName": "adblockplus",
- "addonVersion": "2.3.2",
- "fullAddon": "adblockplus 2.3.2",
- "application": "firefox",
- "applicationVersion": "22.0",
- "fullApplication": "firefox 22.0",
- "platform": "gecko",
- "platformVersion": "22.0",
- "fullPlatform": "gecko 22.0",
- "downloadInterval": "2 hour(s)",
- "previousDownload": "same day",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'exceptionrules.txt',
+ 'query': 'addonName=adblockplus&addonVersion=2.3.2&application=firefox&applicationVersion=22.0&platform=gecko&platformVersion=22.0&lastVersion=201307311503',
+ 'size': 14303,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Firefox',
+ 'uaversion': '22.0',
+ 'fullua': 'Firefox 22.0',
+ 'clientid': '-',
+ 'addonName': 'adblockplus',
+ 'addonVersion': '2.3.2',
+ 'fullAddon': 'adblockplus 2.3.2',
+ 'application': 'firefox',
+ 'applicationVersion': '22.0',
+ 'fullApplication': 'firefox 22.0',
+ 'platform': 'gecko',
+ 'platformVersion': '22.0',
+ 'fullPlatform': 'gecko 22.0',
+ 'downloadInterval': '2 hour(s)',
+ 'previousDownload': 'same day',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylist.txt?_=1375446528229 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"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "easylist.txt",
- "query": "_=1375446528229",
- "size": 326120,
- "referrer": "-",
- "status": 200,
- "ua": "Chrome",
- "uaversion": "28.0",
- "fullua": "Chrome 28.0",
- "clientid": "AdBlock/2.6.2",
- "addonName": "chromeadblock",
- "addonVersion": "2.6.2",
- "fullAddon": "chromeadblock 2.6.2",
- "application": "unknown",
- "applicationVersion": "unknown",
- "fullApplication": "unknown unknown",
- "platform": "unknown",
- "platformVersion": "unknown",
- "fullPlatform": "unknown unknown",
- "downloadInterval": "unknown",
- "previousDownload": "unknown",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'easylist.txt',
+ 'query': '_=1375446528229',
+ 'size': 326120,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Chrome',
+ 'uaversion': '28.0',
+ 'fullua': 'Chrome 28.0',
+ 'clientid': 'AdBlock/2.6.2',
+ 'addonName': 'chromeadblock',
+ 'addonVersion': '2.6.2',
+ 'fullAddon': 'chromeadblock 2.6.2',
+ 'application': 'unknown',
+ 'applicationVersion': 'unknown',
+ 'fullApplication': 'unknown unknown',
+ 'platform': 'unknown',
+ 'platformVersion': 'unknown',
+ 'fullPlatform': 'unknown unknown',
+ 'downloadInterval': 'unknown',
+ 'previousDownload': 'unknown',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.txt HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "easylistitaly.txt",
- "query": "",
- "size": 85879,
- "referrer": "-",
- "status": 200,
- "ua": "Other",
- "uaversion": "",
- "fullua": "Other ",
- "clientid": "-",
- "addonName": "unknown",
- "addonVersion": "unknown",
- "fullAddon": "unknown unknown",
- "application": "unknown",
- "applicationVersion": "unknown",
- "fullApplication": "unknown unknown",
- "platform": "unknown",
- "platformVersion": "unknown",
- "fullPlatform": "unknown unknown",
- "downloadInterval": "unknown",
- "previousDownload": "unknown",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'easylistitaly.txt',
+ 'query': '',
+ 'size': 85879,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Other',
+ 'uaversion': '',
+ 'fullua': 'Other ',
+ 'clientid': '-',
+ 'addonName': 'unknown',
+ 'addonVersion': 'unknown',
+ 'fullAddon': 'unknown unknown',
+ 'application': 'unknown',
+ 'applicationVersion': 'unknown',
+ 'fullApplication': 'unknown unknown',
+ 'platform': 'unknown',
+ 'platformVersion': 'unknown',
+ 'fullPlatform': 'unknown unknown',
+ 'downloadInterval': 'unknown',
+ 'previousDownload': 'unknown',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /easylistitaly.tpl HTTP/1.1" 200 85879 "-" "-" "-" https "-" "easylist-downloads.adblockplus.org" "-"',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "easylistitaly.tpl",
- "query": "",
- "size": 85879,
- "referrer": "-",
- "status": 200,
- "ua": "Other",
- "uaversion": "",
- "fullua": "Other ",
- "clientid": "-",
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'easylistitaly.tpl',
+ 'query': '',
+ 'size': 85879,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Other',
+ 'uaversion': '',
+ 'fullua': 'Other ',
+ 'clientid': '-',
}
),
(
'1.2.3.4 - - [31/Jul/2013:12:03:08 -0530] "GET /notification.json?addonName=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationVersion=28.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=201307292310 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',
{
- "ip": "1.2.3.4",
- "country": "xy",
- "time": datetime(2013, 7, 31, 17, 33, 8),
- "day": 31,
- "weekday": 2,
- "hour": 17,
- "month": "201307",
- "file": "notification.json",
- "query": "addonName=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationVersion=28.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=201307292310",
- "size": 299,
- "referrer": "-",
- "status": 200,
- "ua": "Chrome",
- "uaversion": "28.0",
- "fullua": "Chrome 28.0",
- "clientid": None,
- "addonName": "adblockpluschrome",
- "addonVersion": "1.5.3",
- "fullAddon": "adblockpluschrome 1.5.3",
- "application": "chrome",
- "applicationVersion": "28.0",
- "fullApplication": "chrome 28.0",
- "platform": "chromium",
- "platformVersion": "28.0",
- "fullPlatform": "chromium 28.0",
- "downloadInterval": "1 day(s)",
- "previousDownload": "2 day(s)",
- "firstInDay": True,
+ 'ip': '1.2.3.4',
+ 'country': 'xy',
+ 'time': datetime(2013, 7, 31, 17, 33, 8),
+ 'day': 31,
+ 'weekday': 2,
+ 'hour': 17,
+ 'month': '201307',
+ 'file': 'notification.json',
+ 'query': 'addonName=adblockpluschrome&addonVersion=1.5.3&application=chrome&applicationVersion=28.0.1500.72&platform=chromium&platformVersion=28.0.1500.72&lastVersion=201307292310',
+ 'size': 299,
+ 'referrer': '-',
+ 'status': 200,
+ 'ua': 'Chrome',
+ 'uaversion': '28.0',
+ 'fullua': 'Chrome 28.0',
+ 'clientid': None,
+ 'addonName': 'adblockpluschrome',
+ 'addonVersion': '1.5.3',
+ 'fullAddon': 'adblockpluschrome 1.5.3',
+ 'application': 'chrome',
+ 'applicationVersion': '28.0',
+ 'fullApplication': 'chrome 28.0',
+ 'platform': 'chromium',
+ 'platformVersion': '28.0',
+ 'fullPlatform': 'chromium 28.0',
+ 'downloadInterval': '1 day(s)',
+ 'previousDownload': '2 day(s)',
+ 'firstInDay': True,
}
),
]
@@ -686,53 +686,53 @@
def test_record_adding(self):
tests = [
(
- {"size": 200},
+ {'size': 200},
{},
(),
- {"hits": 1, "bandwidth": 200},
+ {'hits': 1, 'bandwidth': 200},
),
(
- {"size": 200},
- {"hits": 12, "bandwidth": 30},
+ {'size': 200},
+ {'hits': 12, 'bandwidth': 30},
(),
- {"hits": 13, "bandwidth": 230},
+ {'hits': 13, 'bandwidth': 230},
),
(
- {"size": 200, "ua": "Foo"},
- {"hits": 12, "bandwidth": 30},
+ {'size': 200, 'ua': 'Foo'},
+ {'hits': 12, 'bandwidth': 30},
(),
- {"hits": 13, "bandwidth": 230, "ua": {"Foo": {"hits": 1, "bandwidth": 200}}},
+ {'hits': 13, 'bandwidth': 230, 'ua': {'Foo': {'hits': 1, 'bandwidth': 200}}},
),
(
- {"size": 200, "ua": "Foo"},
- {"hits": 12, "bandwidth": 30, "ua": {"Bar": {"hits": 21, "bandwidth": 1200}}},
+ {'size': 200, 'ua': 'Foo'},
+ {'hits': 12, 'bandwidth': 30, 'ua': {'Bar': {'hits': 21, 'bandwidth': 1200}}},
(),
- {"hits": 13, "bandwidth": 230, "ua": {"Bar": {"hits": 21, "bandwidth": 1200}, "Foo": {"hits": 1, "bandwidth": 200}}},
+ {'hits': 13, 'bandwidth': 230, 'ua': {'Bar': {'hits': 21, 'bandwidth': 1200}, 'Foo': {'hits': 1, 'bandwidth': 200}}},
),
(
- {"size": 200, "ua": "Foo", "bar": "xyz"},
- {"hits": 12, "bandwidth": 30, "ua": {"Foo": {"hits": 21, "bandwidth": 1200}}},
+ {'size': 200, 'ua': 'Foo', 'bar': 'xyz'},
+ {'hits': 12, 'bandwidth': 30, 'ua': {'Foo': {'hits': 21, 'bandwidth': 1200}}},
(),
- {"hits": 13, "bandwidth": 230, "ua": {"Foo": {"hits": 22, "bandwidth": 1400}}},
+ {'hits': 13, 'bandwidth': 230, 'ua': {'Foo': {'hits': 22, 'bandwidth': 1400}}},
),
(
- {"size": 200, "ua": "Foo", "addonName": "bar"},
+ {'size': 200, 'ua': 'Foo', 'addonName': 'bar'},
{},
(),
{
- "hits": 1, "bandwidth": 200,
- "ua": {"Foo": {"hits": 1, "bandwidth": 200, "addonName": {"bar": {"hits": 1, "bandwidth": 200}}}},
- "addonName": {"bar": {"hits": 1, "bandwidth": 200, "ua": {"Foo": {"hits": 1, "bandwidth": 200}}}}
+ 'hits': 1, 'bandwidth': 200,
+ 'ua': {'Foo': {'hits': 1, 'bandwidth': 200, 'addonName': {'bar': {'hits': 1, 'bandwidth': 200}}}},
+ 'addonName': {'bar': {'hits': 1, 'bandwidth': 200, 'ua': {'Foo': {'hits': 1, 'bandwidth': 200}}}}
},
),
(
- {"size": 200, "ua": "Foo", "addonName": "bar", "platform": "xyz"},
+ {'size': 200, 'ua': 'Foo', 'addonName': 'bar', 'platform': 'xyz'},
{},
- ("platform",),
+ ('platform',),
{
- "hits": 1, "bandwidth": 200,
- "ua": {"Foo": {"hits": 1, "bandwidth": 200}},
- "addonName": {"bar": {"hits": 1, "bandwidth": 200}}
+ 'hits': 1, 'bandwidth': 200,
+ 'ua': {'Foo': {'hits': 1, 'bandwidth': 200}},
+ 'addonName': {'bar': {'hits': 1, 'bandwidth': 200}}
},
),
]

Powered by Google App Engine
This is Rietveld