aboutsummaryrefslogtreecommitdiff
path: root/tests/test_alchemy.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_alchemy.py')
-rw-r--r--tests/test_alchemy.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_alchemy.py b/tests/test_alchemy.py
index 4255417..b9222eb 100644
--- a/tests/test_alchemy.py
+++ b/tests/test_alchemy.py
@@ -36,7 +36,8 @@ if sqlalchemy:
else:
class Fake(object):
- FACTORY_SESSION = None
+ class Meta:
+ sqlalchemy_session = None
models = Fake()
models.StandardModel = Fake()
@@ -46,16 +47,18 @@ else:
class StandardFactory(SQLAlchemyModelFactory):
- FACTORY_FOR = models.StandardModel
- FACTORY_SESSION = models.session
+ class Meta:
+ model = models.StandardModel
+ sqlalchemy_session = models.session
id = factory.Sequence(lambda n: n)
foo = factory.Sequence(lambda n: 'foo%d' % n)
class NonIntegerPkFactory(SQLAlchemyModelFactory):
- FACTORY_FOR = models.NonIntegerPk
- FACTORY_SESSION = models.session
+ class Meta:
+ model = models.NonIntegerPk
+ sqlalchemy_session = models.session
id = factory.Sequence(lambda n: 'foo%d' % n)
@@ -66,7 +69,7 @@ class SQLAlchemyPkSequenceTestCase(unittest.TestCase):
def setUp(self):
super(SQLAlchemyPkSequenceTestCase, self).setUp()
StandardFactory.reset_sequence(1)
- NonIntegerPkFactory.FACTORY_SESSION.rollback()
+ NonIntegerPkFactory._meta.sqlalchemy_session.rollback()
def test_pk_first(self):
std = StandardFactory.build()
@@ -104,7 +107,7 @@ class SQLAlchemyNonIntegerPkTestCase(unittest.TestCase):
def setUp(self):
super(SQLAlchemyNonIntegerPkTestCase, self).setUp()
NonIntegerPkFactory.reset_sequence()
- NonIntegerPkFactory.FACTORY_SESSION.rollback()
+ NonIntegerPkFactory._meta.sqlalchemy_session.rollback()
def test_first(self):
nonint = NonIntegerPkFactory.build()