diff options
author | Ilya Pekelny <ipekelny@mirantis.com> | 2014-07-24 19:27:18 +0300 |
---|---|---|
committer | Ilya Pekelny <ipekelny@mirantis.com> | 2014-08-08 10:05:30 +0300 |
commit | a0e0f4c289b46c0c9a051c08d7f9a1929e0e30ce (patch) | |
tree | 92a5293a2bc75cb27082b3b3c6f358325005d890 /test/dialect/postgresql/test_reflection.py | |
parent | 10bb97e89a5bdf6fab31c95f8f5a7a07b5d534bc (diff) | |
download | sqlalchemy-a0e0f4c289b46c0c9a051c08d7f9a1929e0e30ce.tar.gz |
Public inspector method to load enum listpr/126
Provide opportunity to get enums list via an inspector instance public
interface.
Diffstat (limited to 'test/dialect/postgresql/test_reflection.py')
-rw-r--r-- | test/dialect/postgresql/test_reflection.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py index 1d6a41765..26de23902 100644 --- a/test/dialect/postgresql/test_reflection.py +++ b/test/dialect/postgresql/test_reflection.py @@ -1,5 +1,6 @@ # coding: utf-8 +from sqlalchemy.engine import reflection from sqlalchemy.testing.assertions import eq_, assert_raises, \ AssertsExecutionResults from sqlalchemy.testing import fixtures @@ -622,6 +623,26 @@ class ReflectionTest(fixtures.TestBase): for fk in fks: eq_(fk, fk_ref[fk['name']]) + @testing.provide_metadata + def test_inspect_enums_custom_schema(self): + conn = testing.db.connect() + enum_type = postgresql.ENUM('sad', 'ok', 'happy', name='mood', + metadata=self.metadata, schema='test_schema') + enum_type.create(conn) + inspector = reflection.Inspector.from_engine(conn.engine) + eq_(inspector.load_enums(conn, 'test_schema'), { + u'test_schema.mood': {'labels': [u'sad', u'ok', u'happy']}}) + + @testing.provide_metadata + def test_inspect_enums_schema(self): + conn = testing.db.connect() + enum_type = postgresql.ENUM('cat', 'dog', 'rat', name='pet', + metadata=self.metadata) + enum_type.create(conn) + inspector = reflection.Inspector.from_engine(conn.engine) + eq_(inspector.load_enums(conn), { + u'pet': {'labels': [u'cat', u'dog', u'rat']}}) + class CustomTypeReflectionTest(fixtures.TestBase): |