commit 6dafb82e017893ead94855bfed98ea8f707b6a21 Author: hiro hiro@torproject.org Date: Fri Oct 18 13:39:00 2019 +0200
Fix check hid --- gettor/parse/email.py | 7 +++---- tests/test_email_service.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gettor/parse/email.py b/gettor/parse/email.py index 64cf5a9..d3d4fa1 100644 --- a/gettor/parse/email.py +++ b/gettor/parse/email.py @@ -151,9 +151,7 @@ class EmailParser(object): return request
- def too_many_requests(self, hid, num_requests, limit): - test_hid = self.settings.get("test_hid") - + def too_many_requests(self, hid, test_hid, num_requests, limit): log.msg( "test_hid {}".format(test_hid), system="email parser" ) @@ -230,6 +228,7 @@ class EmailParser(object): email_requests_limit = self.settings.get("email_requests_limit") now_str = datetime.now().strftime("%Y%m%d%H%M%S") dbname = self.settings.get("dbname") + test_hid = self.settings.get("test_hid") conn = SQLite3(dbname)
if request["command"]: @@ -247,7 +246,7 @@ class EmailParser(object): )
check = self.too_many_requests( - hid, num_requests[0][0], email_requests_limit + hid, test_hid, num_requests[0][0], email_requests_limit )
if check: diff --git a/tests/test_email_service.py b/tests/test_email_service.py index d15e813..4c8ff10 100644 --- a/tests/test_email_service.py +++ b/tests/test_email_service.py @@ -65,7 +65,7 @@ class EmailServiceTests(unittest.TestCase): hid = "80d7054da0d3826563c7babb5453e18f3e42f932e562c5ab0434aec9df7b0625" limit = self.settings.get("email_requests_limit") num_requests = 300 - check = ep.too_many_requests(hid, num_requests, limit) + check = ep.too_many_requests(hid, self.settings.get("test_hid"), num_requests, limit) self.assertEqual(hid, self.settings.get("test_hid")) self.assertEqual(check, False)
tor-commits@lists.torproject.org