Fix the tests and the one bug that it highlighted.

This commit is contained in:
jakedt 2014-02-16 18:59:24 -05:00
parent b619356907
commit e7064f1191
6 changed files with 53 additions and 24 deletions

View file

@ -33,7 +33,15 @@ class MailConfig(object):
TESTING = False
class SQLiteDB(object):
class RealTransactions(object):
@staticmethod
def create_transaction(db):
return db.transaction()
DB_TRANSACTION_FACTORY = create_transaction
class SQLiteDB(RealTransactions):
DB_NAME = 'test/data/test.db'
DB_CONNECTION_ARGS = {
'threadlocals': True
@ -41,13 +49,27 @@ class SQLiteDB(object):
DB_DRIVER = SqliteDatabase
class FakeTransaction(object):
def __enter__(self):
return self
def __exit__(self, exc_type, value, traceback):
pass
class EphemeralDB(object):
DB_NAME = ':memory:'
DB_CONNECTION_ARGS = {}
DB_DRIVER = SqliteDatabase
@staticmethod
def create_transaction(db):
return FakeTransaction()
class RDSMySQL(object):
DB_TRANSACTION_FACTORY = create_transaction
class RDSMySQL(RealTransactions):
DB_NAME = 'quay'
DB_CONNECTION_ARGS = {
'host': 'fluxmonkeylogin.cb0vumcygprn.us-east-1.rds.amazonaws.com',