#NEWLINE# def test_column_change_grants( self ) : #NEWLINE# #INDENT# 'Change existing colum-level privileges' #NEWLINE# inmap = self . std_map ( ) #NEWLINE# inmap [ 'schema public' ] . update ( { #NEWLINE# #INDENT# 'table t1' : { #NEWLINE# #INDENT# 'columns' : [ { #NEWLINE# #INDENT# 'c1' : { #NEWLINE# #INDENT# 'type' : 'integer' , #NEWLINE# 'privileges' : [ { #NEWLINE# #INDENT# 'user1' : [ 'insert' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'user2' : [ 'insert' , 'update' ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'c2' : { #NEWLINE# #INDENT# 'type' : 'text' , #NEWLINE# 'privileges' : [ { #NEWLINE# #INDENT# 'user1' : [ 'insert' ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'owner' : self . db . user , #NEWLINE# 'privileges' : [ { #NEWLINE# #INDENT# self . db . user : [ 'all' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'PUBLIC' : [ 'select' ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# stmts = [ CREATE_TABLE , ( GRANT_SELECT % 'PUBLIC' ) , 'GRANT INSERT (c1, c2) ON t1 TO user1' , 'GRANT INSERT (c2), UPDATE (c2) ON t1 TO user2' ] #NEWLINE# sql = self . to_sql ( inmap , self ) #NEWLINE# assert ( len ( sql ) == 2 ) #NEWLINE# assert ( sql [ 0 ] == 'GRANT INSERT (c1), UPDATE (c1) ON TABLE t1 TO user2' ) #NEWLINE# assert ( sql [ 1 ] == 'REVOKE INSERT (c2), UPDATE (c2) ON TABLE t1 FROM user2' )