commit c6cfd912410f673961db28e7c68dd413c67d5e7e Author: Cecylia Bocovich cohosh@torproject.org Date: Fri Feb 14 17:23:39 2020 -0500
Add database tests --- tests/conftests.py | 1 + tests/test_db.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
diff --git a/tests/conftests.py b/tests/conftests.py index cbb4d28..d509776 100644 --- a/tests/conftests.py +++ b/tests/conftests.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals from gettor.utils import options from gettor.utils import strings from gettor.utils import twitter +from gettor.utils.db import SQLite3 from gettor.services.email.sendmail import Sendmail from gettor.services.twitter import twitterdm from gettor.parse.email import EmailParser, AddressError, DKIMError diff --git a/tests/test_db.py b/tests/test_db.py new file mode 100644 index 0000000..e956850 --- /dev/null +++ b/tests/test_db.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +import pytest +import pytest_twisted +from twisted.trial import unittest +from twisted.internet import defer, reactor +from twisted.internet import task + +from . import conftests + +class DatabaseTests(unittest.TestCase): + + # Fail any tests which take longer than 15 seconds. + timeout = 15 + def setUp(self): + self.settings = conftests.options.parse_settings("en","./gettor.conf.json") + self.locales = conftests.strings.get_locales() + + self.conn = conftests.SQLite3(self.settings.get("dbname")) + + def tearDown(self): + print("tearDown()") + return self.conn.dbpool.close() + + @pytest_twisted.inlineCallbacks + def test_stored_locales(self): + locales = yield self.conn.get_locales() + +if __name__ == "__main__": + unittest.main()