diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-14 13:25:18 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-14 13:25:18 -0400 |
commit | 4fd02761188764e3b82db36da47127a8dcfb950e (patch) | |
tree | f6eb78882c77ef8d968812ce83302eca4add8326 /tests/test_op.py | |
parent | 6f8d0f2e2d119a092bd4c46c42eca2d4737e0d23 (diff) | |
download | alembic-4fd02761188764e3b82db36da47127a8dcfb950e.tar.gz |
- handle missing arg more clearly
- add missing translate for create_pk
Diffstat (limited to 'tests/test_op.py')
-rw-r--r-- | tests/test_op.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_op.py b/tests/test_op.py index 610c948..396ddf7 100644 --- a/tests/test_op.py +++ b/tests/test_op.py @@ -606,6 +606,36 @@ class OpTest(TestBase): "ALTER TABLE t1 ADD CONSTRAINT uk_test UNIQUE (foo, bar)" ) + def test_drop_constraint_legacy_kwarg(self): + context = op_fixture() + op.drop_constraint(name='pk_name', + table_name='sometable', + type_='primary') + context.assert_( + "ALTER TABLE sometable DROP CONSTRAINT pk_name" + ) + + def test_create_pk_legacy_kwarg(self): + context = op_fixture() + op.create_primary_key(name=None, + table_name='sometable', + cols=['router_id', 'l3_agent_id']) + context.assert_( + "ALTER TABLE sometable ADD PRIMARY KEY (router_id, l3_agent_id)" + ) + + def test_legacy_kwarg_catches_arg_missing(self): + op_fixture() + + assert_raises_message( + TypeError, + "missing required positional argument: columns", + op.create_primary_key, + name=None, + table_name='sometable', + wrong_cols=['router_id', 'l3_agent_id'] + ) + def test_add_unique_constraint_schema(self): context = op_fixture() op.create_unique_constraint( |