Commit 6dafb82e authored by Hiro's avatar Hiro 🏄
Browse files

Fix check hid

parent 41c72250
......@@ -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:
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment