[tor-commits] [gettor/master] Log checks temporarily

hiro at torproject.org hiro at torproject.org
Fri Oct 18 11:00:27 UTC 2019


commit 4515c62f58e4107328c097d87be8877148dc7bef
Author: hiro <hiro at torproject.org>
Date:   Fri Oct 18 13:00:22 2019 +0200

    Log checks temporarily
---
 gettor/parse/email.py       | 11 ++++++++---
 tests/test_email_service.py |  1 -
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gettor/parse/email.py b/gettor/parse/email.py
index 52d97ec..decc13e 100644
--- a/gettor/parse/email.py
+++ b/gettor/parse/email.py
@@ -152,7 +152,14 @@ class EmailParser(object):
 
 
     def too_many_requests(self, hid, num_requests, limit):
-        if hid == self.settings.get('test_hid'):
+        test_hid = self.settings.get('test_hid')
+        log.msg(
+            "test_hid {}".format(test_hid), system="email parser"
+        )
+        log.msg(
+            "hid {}".format(hid), system="email parser"
+        )
+        if hid == test_hid:
             return False
         elif num_requests < limit:
             return False
@@ -245,8 +252,6 @@ class EmailParser(object):
             )
 
             log.msg("check: {}".format(check), system="email parser")
-            log.msg("hid: {}".format(hid), system="email parser")
-            log.msg("request['id']: {}".format(request['id']), system="email parser")
 
             if check:
                 log.msg(
diff --git a/tests/test_email_service.py b/tests/test_email_service.py
index 8e7adf0..0ec8b17 100644
--- a/tests/test_email_service.py
+++ b/tests/test_email_service.py
@@ -63,7 +63,6 @@ class EmailServiceTests(unittest.TestCase):
     def test_too_many_request_exclude(self):
         ep = conftests.EmailParser(self.settings, "gettor at torproject.org")
         hid = "80d7054da0d3826563c7babb5453e18f3e42f932e562c5ab0434aec9df7b0625"
-        request_service = "osx"
         limit = self.settings.get("email_requests_limit")
         num_requests = 300
         check = ep.too_many_requests(hid, num_requests, limit)



More information about the tor-commits mailing list