diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-17 13:11:22 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-17 13:11:22 -0400 |
commit | be57def4b909a447b10fff21bf957c804132b5ec (patch) | |
tree | 8f9e49f29d7a1eba4a769d736f7f97d10390366e /test/dialect/postgresql/test_reflection.py | |
parent | 27617986bbeb028cd2cc0a021e20df517e12a2c5 (diff) | |
download | sqlalchemy-pr128.tar.gz |
- repair get_foreign_table_names() for PGInsp/dialect levelpr128
- repair get_view_names()
- changelog + migration note
Diffstat (limited to 'test/dialect/postgresql/test_reflection.py')
-rw-r--r-- | test/dialect/postgresql/test_reflection.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/dialect/postgresql/test_reflection.py b/test/dialect/postgresql/test_reflection.py index 4bc658694..b8b9be3de 100644 --- a/test/dialect/postgresql/test_reflection.py +++ b/test/dialect/postgresql/test_reflection.py @@ -59,9 +59,15 @@ class ForeignTableReflectionTest(fixtures.TablesTest, AssertsExecutionResults): def test_get_foreign_table_names(self): inspector = inspect(testing.db) with testing.db.connect() as conn: - ft_names = inspector.get_foreign_table_names(conn) + ft_names = inspector.get_foreign_table_names() eq_(ft_names, ['test_foreigntable']) + def test_get_table_names_no_foreign(self): + inspector = inspect(testing.db) + with testing.db.connect() as conn: + names = inspector.get_table_names() + eq_(names, ['testtable']) + class MaterialiedViewReflectionTest( fixtures.TablesTest, AssertsExecutionResults): @@ -85,15 +91,24 @@ class MaterialiedViewReflectionTest( {"id": 89, "data": 'd1'} ) - view = sa.DDL( + materialized_view = sa.DDL( "CREATE MATERIALIZED VIEW test_mview AS " "SELECT * FROM testtable") - sa.event.listen(testtable, 'after_create', view) + plain_view = sa.DDL( + "CREATE VIEW test_regview AS " + "SELECT * FROM testtable") + + sa.event.listen(testtable, 'after_create', plain_view) + sa.event.listen(testtable, 'after_create', materialized_view) sa.event.listen( testtable, 'before_drop', sa.DDL("DROP MATERIALIZED VIEW test_mview") ) + sa.event.listen( + testtable, 'before_drop', + sa.DDL("DROP VIEW test_regview") + ) def test_mview_is_reflected(self): metadata = MetaData(testing.db) @@ -109,6 +124,10 @@ class MaterialiedViewReflectionTest( [(89, 'd1',)] ) + def test_get_view_names(self): + insp = inspect(testing.db) + eq_(set(insp.get_view_names()), set(['test_mview', 'test_regview'])) + class DomainReflectionTest(fixtures.TestBase, AssertsExecutionResults): """Test PostgreSQL domains""" |