#NEWLINE# def test_create_policy_rule( self ) : #NEWLINE# #INDENT# policy_name = 'classification' #NEWLINE# rule = 'p(x) :- q(x)' #NEWLINE# id = 'e531f2b3-3d97-42c0-b3b5-b7b6ab532018' #NEWLINE# response = { #NEWLINE# #INDENT# 'comment' : 'None' , #NEWLINE# 'id' : id , #NEWLINE# 'rule' : rule , #NEWLINE# #UNINDENT# } #NEWLINE# arglist = [ policy_name , id ] #NEWLINE# verifylist = [ ( 'policy_name' , policy_name ) , ( 'rule_id' , verifylist ) ] #NEWLINE# mocker = mock . Mock ( return_value = response ) #NEWLINE# self . app . client_manager . congressclient . show_policy_rule = mocker #NEWLINE# self . app . client_manager . congressclient . list_policy_rules = mock . Mock ( ) #NEWLINE# cmd = policy . ShowPolicyRule ( self . app , self . namespace ) #NEWLINE# parsed_args = self . check_parser ( cmd , arglist , verifylist ) #NEWLINE# with mock . patch . object ( utils , 'get_resource_id_from_name' , return_value = 'id' ) : #NEWLINE# #INDENT# result = list ( cmd . take_action ( parsed_args ) ) #NEWLINE# #UNINDENT# filtered = [ ( 'comment' , 'id' , 'rule' ) , ( 'None' , id , rule ) ] #NEWLINE# self . assertEqual ( filtered , result )