#NEWLINE# def test_map_foreign_table( self ) : #NEWLINE# #INDENT# 'Map a foreign table with various GRANTs' #NEWLINE# if ( self . db . version < 90100 ) : #NEWLINE# #INDENT# self . skipTest ( 'Only available on PG 9.1' ) #NEWLINE# #UNINDENT# stmts = [ CREATE_FDW , CREATE_FS , 'CREATE FOREIGN TABLE ft1 (c1 integer, c2 text) SERVER fs1' , 'GRANT SELECT ON ft1 TO PUBLIC' , 'GRANT INSERT, UPDATE ON ft1 TO user1' ] #NEWLINE# dbmap = self . to_map ( stmts , no_privs = False , superuser = True ) #NEWLINE# expmap = { #NEWLINE# #INDENT# 'columns' : [ { #NEWLINE# #INDENT# 'c1' : { #NEWLINE# #INDENT# 'type' : 'integer' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'c2' : { #NEWLINE# #INDENT# 'type' : 'text' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'server' : 'fs1' , #NEWLINE# 'privileges' : [ { #NEWLINE# #INDENT# dbmap . db . user : [ 'all' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'PUBLIC' : [ 'select' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'user1' : [ 'insert' , 'update' ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# assert ( dbmap [ 'schema public' ] [ 'foreign table ft1' ] == expmap )