#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . fwaas : ( 'policy_get' , 'policy_remove_rule' , 'rule_list' , 'rule_get' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_policy_remove_rule( self ) : #NEWLINE# #INDENT# policy = self . fw_policies . first ( ) #NEWLINE# tenant_id = self . tenant . id #NEWLINE# rules = self . fw_rules . list ( ) #NEWLINE# remove_rule_id = policy . firewall_rules [ 0 ] #NEWLINE# left_rule_id = policy . firewall_rules [ 1 ] #NEWLINE# data = { #NEWLINE# #INDENT# 'firewall_rule_id' : remove_rule_id , #NEWLINE# #UNINDENT# } #NEWLINE# after_remove_policy_dict = { #NEWLINE# #INDENT# 'id' : 'abcdef-c3eb-4fee-9763-12de3338041e' , #NEWLINE# 'tenant_id' : '1' , #NEWLINE# 'name' : 'policy1' , #NEWLINE# 'description' : 'policy description' , #NEWLINE# 'firewall_rules' : [ left_rule_id ] , #NEWLINE# 'audited' : True , #NEWLINE# 'shared' : True , #NEWLINE# #UNINDENT# } #NEWLINE# after_remove_policy = fwaas . Policy ( after_remove_policy_dict ) #NEWLINE# api . fwaas . policy_get ( IsA ( http . HttpRequest ) , policy . id ) . AndReturn ( policy ) #NEWLINE# api . fwaas . rule_list ( IsA ( http . HttpRequest ) , tenant_id = tenant_id ) . AndReturn ( rules ) #NEWLINE# api . fwaas . rule_get ( IsA ( http . HttpRequest ) , remove_rule_id ) . AndReturn ( rules [ 0 ] ) #NEWLINE# api . fwaas . policy_remove_rule ( IsA ( http . HttpRequest ) , policy . id , ** data ) . AndReturn ( remove_rule_id ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# res = self . client . post ( reverse ( self . REMOVERULE_PATH , args = ( policy . id , ) ) , data ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) )