[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Add updates for db connections
commit 3726d31b4ec2fb51006b1bca9c78ad76443d2d97
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date: Wed May 22 18:09:10 2019 +0200
Add updates for db connections
---
gettor/utils/db.py | 8 ++++----
tests/test_email_service.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gettor/utils/db.py b/gettor/utils/db.py
index 8d65f45..73610ed 100644
--- a/gettor/utils/db.py
+++ b/gettor/utils/db.py
@@ -45,7 +45,7 @@ class SQLite3(object):
"""
Perform a new request to the database
"""
- query = "INSERT INTO requests VALUES(?, ?, ?, ?, ?, ?)"
+ query = "INSERT INTO requests VALUES(?, ?, ?, ?, ?, ?, ?)"
return self.dbpool.runQuery(
query, (id, command, platform, language, service, date, status)
@@ -96,11 +96,11 @@ class SQLite3(object):
query, (now_str,platform, command, service, now_str)
).addCallback(self.query_callback).addErrback(self.query_errback)
- def get_links(self, platform, status):
+ def get_links(self, platform, language, status):
"""
Get links from the database per platform
"""
- query = "SELECT * FROM links WHERE platform=? AND status=?"
+ query = "SELECT * FROM links WHERE platform=? AND language=? AND status=?"
return self.dbpool.runQuery(
- query, (platform, status)
+ query, (platform, language, status)
).addCallback(self.query_callback).addErrback(self.query_errback)
diff --git a/tests/test_email_service.py b/tests/test_email_service.py
index a4a7405..9abef57 100644
--- a/tests/test_email_service.py
+++ b/tests/test_email_service.py
@@ -27,7 +27,7 @@ class EmailServiceTests(unittest.TestCase):
def test_language_email_parser(self):
ep = conftests.EmailParser(self.settings, "gettor@xxxxxxxxxxxxxx")
- request = ep.parse("From: \"silvia [hiro]\" <hiro@xxxxxxxxxxxxxx>\n Subject: osx en\r\n Reply-To: hiro@xxxxxxxxxxxxxx \nTo: gettor@xxxxxxxxxxxxxx\n osx English")
+ request = ep.parse("From: \"silvia [hiro]\" <hiro@xxxxxxxxxxxxxx>\n Subject: \r\n Reply-To: hiro@xxxxxxxxxxxxxx \nTo: gettor@xxxxxxxxxxxxxx\n osx en")
self.assertEqual(request["command"], "links")
self.assertEqual(request["platform"], "osx")
self.assertEqual(request["language"], "en")
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits