Skip to content

Commit

Permalink
use sqlalchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Donowitz committed Oct 5, 2021
1 parent 172f3e6 commit 4401cb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 2 additions & 1 deletion tools/integration_tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
hawkauthlib
konfig
mysql-connector-python
mysqlclient
psutil
pyjwt
pyramid
pyramid_hawkauth
pyfxa
requests
simplejson
sqlalchemy
tokenlib
unittest2
webtest
Expand Down
13 changes: 4 additions & 9 deletions tools/integration_tests/tokenserver/test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import urllib.parse as urlparse

from sqlalchemy import create_engine
from tokenlib.utils import decode_token_bytes
from webtest import TestApp

Expand All @@ -25,13 +26,8 @@ class TestCase:
TOKENSERVER_HOST = os.environ['TOKENSERVER_HOST']

def setUp(self):
self.database = mysql.connector.connect(
user=os.environ['TOKENSERVER_DATABASE_USER'],
password=os.environ['TOKENSERVER_DATABASE_PASSWORD'],
host=os.environ['TOKENSERVER_DATABASE_HOST'],
database=os.environ['TOKENSERVER_DATABASE_NAME']
)
self.database.autocommit = True
engine = create_engine(os.environ['SYNC_TOKENSERVER__DATABASE_URL'])
self.database = engine.execution_options(isolation_level="AUTOCOMMIT").connect()

host_url = urlparse.urlparse(self.TOKENSERVER_HOST)
self.app = TestApp(self.TOKENSERVER_HOST, extra_environ={
Expand Down Expand Up @@ -221,8 +217,7 @@ def _count_users(self):
return count

def _execute_sql(self, query, args):
cursor = self.database.cursor()
cursor.execute(query, args)
cursor = self.database.execute(query, args)

return cursor

Expand Down

0 comments on commit 4401cb9

Please sign in to comment.