summaryrefslogtreecommitdiff
path: root/tests/test_op.py
diff options
context:
space:
mode:
authorPedro Romano <pedro.romano@salesseek.co.uk>2013-08-25 12:35:16 +0100
committerPedro Romano <pedro.romano@salesseek.co.uk>2013-08-25 12:35:16 +0100
commitc5476fc7aa295e9e6215ec90384721f4f984afef (patch)
tree22aef66a961661365af0a870214f73f76f5bfa55 /tests/test_op.py
parentcb5935fafa3740ddf2fbbeaf2bcc99c837a2d420 (diff)
downloadalembic-c5476fc7aa295e9e6215ec90384721f4f984afef.tar.gz
Support 'deferrable' keyword argument for 'create_foreign_key' operation.
Diffstat (limited to 'tests/test_op.py')
-rw-r--r--tests/test_op.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_op.py b/tests/test_op.py
index f1ab257..581b606 100644
--- a/tests/test_op.py
+++ b/tests/test_op.py
@@ -386,6 +386,16 @@ def test_add_foreign_key_ondelete():
"REFERENCES t2 (bat, hoho) ON DELETE CASCADE"
)
+def test_add_foreign_key_deferrable():
+ context = op_fixture()
+ op.create_foreign_key('fk_test', 't1', 't2',
+ ['foo', 'bar'], ['bat', 'hoho'],
+ deferrable=True)
+ context.assert_(
+ "ALTER TABLE t1 ADD CONSTRAINT fk_test FOREIGN KEY(foo, bar) "
+ "REFERENCES t2 (bat, hoho) DEFERRABLE"
+ )
+
def test_add_foreign_key_self_referential():
context = op_fixture()
op.create_foreign_key("fk_test", "t1", "t1", ["foo"], ["bar"])