#NEWLINE# def test_present_group( self ) : #NEWLINE# #INDENT# '\n        Test present group\n        ' #NEWLINE# with patch . dict ( postgres_privileges . __salt__ , { #NEWLINE# #INDENT# 'postgres.has_privileges' : self . mock_false , #NEWLINE# 'postgres.privileges_grant' : self . mock_true , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# with patch . dict ( postgres_privileges . __opts__ , { #NEWLINE# #INDENT# 'test' : True , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# comt = 'The privilege(s): {0} are set to be granted to {1}' . format ( self . group_name , self . name ) #NEWLINE# self . ret . update ( { #NEWLINE# #INDENT# 'comment' : comt , #NEWLINE# 'result' : None , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertDictEqual ( postgres_privileges . present ( self . name , self . group_name , 'group' ) , self . ret ) #NEWLINE# #UNINDENT# with patch . dict ( postgres_privileges . __opts__ , { #NEWLINE# #INDENT# 'test' : False , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# comt = 'The privilege(s): {0} have been granted to {1}' . format ( self . group_name , self . name ) #NEWLINE# self . ret . update ( { #NEWLINE# #INDENT# 'comment' : comt , #NEWLINE# 'result' : True , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# 'baruwa' : 'Present' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertDictEqual ( postgres_privileges . present ( self . name , self . group_name , 'group' ) , self . ret )