summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite/test_sequence.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-02-06 16:36:35 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-02-06 16:36:35 -0500
commit4ad4e9fccbb263ac2a0e6bf5f84526b2dee19ece (patch)
tree0a8040640e864035d753b7d42858e588aa0a2ece /lib/sqlalchemy/testing/suite/test_sequence.py
parent827b936bc0f43cfee374bf465e205747f77fe9f7 (diff)
downloadsqlalchemy-4ad4e9fccbb263ac2a0e6bf5f84526b2dee19ece.tar.gz
- cleanup HasSequence and move it to test_sequences
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_sequence.py')
-rw-r--r--lib/sqlalchemy/testing/suite/test_sequence.py58
1 files changed, 57 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_sequence.py b/lib/sqlalchemy/testing/suite/test_sequence.py
index 366d509cc..6c6ba5795 100644
--- a/lib/sqlalchemy/testing/suite/test_sequence.py
+++ b/lib/sqlalchemy/testing/suite/test_sequence.py
@@ -1,8 +1,9 @@
from .. import fixtures, config
from ..config import requirements
from ..assertions import eq_
+from ... import testing
-from sqlalchemy import Integer, String, Sequence
+from ... import Integer, String, Sequence, schema
from ..schema import Table, Column
@@ -68,3 +69,58 @@ class SequenceTest(fixtures.TablesTest):
(1, "some data")
)
+
+class HasSequenceTest(fixtures.TestBase):
+ __requires__ = 'sequences',
+
+ def test_has_sequence(self):
+ s1 = Sequence('user_id_seq')
+ testing.db.execute(schema.CreateSequence(s1))
+ try:
+ eq_(testing.db.dialect.has_sequence(testing.db,
+ 'user_id_seq'), True)
+ finally:
+ testing.db.execute(schema.DropSequence(s1))
+
+ @testing.requires.schemas
+ def test_has_sequence_schema(self):
+ s1 = Sequence('user_id_seq', schema="test_schema")
+ testing.db.execute(schema.CreateSequence(s1))
+ try:
+ eq_(testing.db.dialect.has_sequence(testing.db,
+ 'user_id_seq', schema="test_schema"), True)
+ finally:
+ testing.db.execute(schema.DropSequence(s1))
+
+ def test_has_sequence_neg(self):
+ eq_(testing.db.dialect.has_sequence(testing.db, 'user_id_seq'),
+ False)
+
+ @testing.requires.schemas
+ def test_has_sequence_schemas_neg(self):
+ eq_(testing.db.dialect.has_sequence(testing.db, 'user_id_seq',
+ schema="test_schema"),
+ False)
+
+ @testing.requires.schemas
+ def test_has_sequence_default_not_in_remote(self):
+ s1 = Sequence('user_id_seq')
+ testing.db.execute(schema.CreateSequence(s1))
+ try:
+ eq_(testing.db.dialect.has_sequence(testing.db, 'user_id_seq',
+ schema="test_schema"),
+ False)
+ finally:
+ testing.db.execute(schema.DropSequence(s1))
+
+ @testing.requires.schemas
+ def test_has_sequence_remote_not_in_default(self):
+ s1 = Sequence('user_id_seq', schema="test_schema")
+ testing.db.execute(schema.CreateSequence(s1))
+ try:
+ eq_(testing.db.dialect.has_sequence(testing.db, 'user_id_seq'),
+ False)
+ finally:
+ testing.db.execute(schema.DropSequence(s1))
+
+