diff options
Diffstat (limited to 'tests/test_op.py')
-rw-r--r-- | tests/test_op.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_op.py b/tests/test_op.py index 8af4711..58f19cb 100644 --- a/tests/test_op.py +++ b/tests/test_op.py @@ -154,6 +154,26 @@ def test_add_foreign_key(): "REFERENCES t2 (bat, hoho)" ) +def test_add_foreign_key_onupdate(): + context = op_fixture() + op.create_foreign_key('fk_test', 't1', 't2', + ['foo', 'bar'], ['bat', 'hoho'], + onupdate='CASCADE') + context.assert_( + "ALTER TABLE t1 ADD CONSTRAINT fk_test FOREIGN KEY(foo, bar) " + "REFERENCES t2 (bat, hoho) ON UPDATE CASCADE" + ) + +def test_add_foreign_key_ondelete(): + context = op_fixture() + op.create_foreign_key('fk_test', 't1', 't2', + ['foo', 'bar'], ['bat', 'hoho'], + ondelete='CASCADE') + context.assert_( + "ALTER TABLE t1 ADD CONSTRAINT fk_test FOREIGN KEY(foo, bar) " + "REFERENCES t2 (bat, hoho) ON DELETE CASCADE" + ) + def test_add_check_constraint(): context = op_fixture() op.create_check_constraint( |