<s> from mox import IsA <EOL> from django . core . urlresolvers import reverse <EOL> from django . core . urlresolvers import reverse_lazy <EOL> from django import http <EOL> from horizon . workflows import views <EOL> from openstack_dashboard import api <EOL> from openstack_dashboard . test import helpers as test <EOL> from openstack_dashboard . dashboards . project . vpn import workflows <EOL> class VPNTests ( test . TestCase ) : <EOL> class AttributeDict ( dict ) : <EOL> def __getattr__ ( self , attr ) : <EOL> return self [ attr ] <EOL> def __setattr__ ( self , attr , value ) : <EOL> self [ attr ] = value <EOL> DASHBOARD = '<STR_LIT>' <EOL> INDEX_URL = reverse_lazy ( '<STR_LIT>' % DASHBOARD ) <EOL> ADDIKEPOLICY_PATH = '<STR_LIT>' % DASHBOARD <EOL> ADDIPSECPOLICY_PATH = '<STR_LIT>' % DASHBOARD <EOL> ADDVPNSERVICE_PATH = '<STR_LIT>' % DASHBOARD <EOL> ADDVPNCONNECTION_PATH = '<STR_LIT>' % DASHBOARD <EOL> IKEPOLICY_DETAIL_PATH = '<STR_LIT>' % DASHBOARD <EOL> IPSECPOLICY_DETAIL_PATH = '<STR_LIT>' % DASHBOARD <EOL> VPNSERVICE_DETAIL_PATH = '<STR_LIT>' % DASHBOARD <EOL> VPNCONNECTION_DETAIL_PATH = '<STR_LIT>' % DASHBOARD <EOL> def set_up_expect ( self ) : <EOL> vpnservice1 , vpnservice2 = self . vpnservices . list ( ) [ : <NUM_LIT:2> ] <EOL> api . vpn . vpnservices_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( self . vpnservices . list ( ) ) <EOL> api . vpn . vpnservice_get ( <EOL> IsA ( http . HttpRequest ) , vpnservice1 . id ) . AndReturn ( vpnservice1 ) <EOL> api . vpn . vpnservice_get ( <EOL> IsA ( http . HttpRequest ) , vpnservice2 . id ) . AndReturn ( vpnservice2 ) <EOL> api . vpn . ikepolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( self . ikepolicies . list ( ) ) <EOL> ikepolicy1 , ikepolicy2 = self . ikepolicies . list ( ) [ : <NUM_LIT:2> ] <EOL> api . vpn . ikepolicy_get ( <EOL> IsA ( http . HttpRequest ) , ikepolicy1 . id ) . AndReturn ( ikepolicy1 ) <EOL> api . vpn . ikepolicy_get ( <EOL> IsA ( http . HttpRequest ) , ikepolicy2 . id ) . AndReturn ( ikepolicy2 ) <EOL> api . vpn . ipsecpolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( self . ipsecpolicies . list ( ) ) <EOL> ipsecpolicy1 , ipsecpolicy2 = self . ipsecpolicies . list ( ) [ : <NUM_LIT:2> ] <EOL> api . vpn . ipsecpolicy_get ( <EOL> IsA ( http . HttpRequest ) , ipsecpolicy1 . id ) . AndReturn ( ipsecpolicy1 ) <EOL> api . vpn . ipsecpolicy_get ( <EOL> IsA ( http . HttpRequest ) , ipsecpolicy2 . id ) . AndReturn ( ipsecpolicy2 ) <EOL> api . vpn . ipsecsiteconnections_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( self . ipsecsiteconnections . list ( ) ) <EOL> def set_up_expect_with_exception ( self ) : <EOL> api . vpn . vpnservices_get ( <EOL> IsA ( http . HttpRequest ) ) . AndRaise ( self . exceptions . neutron ) <EOL> api . vpn . ikepolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndRaise ( self . exceptions . neutron ) <EOL> api . vpn . ipsecpolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndRaise ( self . exceptions . neutron ) <EOL> api . vpn . ipsecsiteconnections_get ( <EOL> IsA ( http . HttpRequest ) ) . AndRaise ( self . exceptions . neutron ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_vpnservices ( self ) : <EOL> self . set_up_expect ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <EOL> len ( self . vpnservices . list ( ) ) ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_ikepolicies ( self ) : <EOL> self . set_up_expect ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <EOL> len ( self . ikepolicies . list ( ) ) ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_ipsecpolicies ( self ) : <EOL> self . set_up_expect ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <EOL> len ( self . ipsecpolicies . list ( ) ) ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_ipsecsiteconnections ( self ) : <EOL> self . set_up_expect ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( <EOL> self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' ) <EOL> self . assertEqual ( <EOL> len ( res . context [ '<STR_LIT>' ] . data ) , <EOL> len ( self . ipsecsiteconnections . list ( ) ) ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_exception_vpnservices ( self ) : <EOL> self . set_up_expect_with_exception ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <NUM_LIT:0> ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_exception_ikepolicies ( self ) : <EOL> self . set_up_expect_with_exception ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <NUM_LIT:0> ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_exception_ipsecpolicies ( self ) : <EOL> self . set_up_expect_with_exception ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <NUM_LIT:0> ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_index_exception_ipsecsiteconnections ( self ) : <EOL> self . set_up_expect_with_exception ( ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( <EOL> self . INDEX_URL + '<STR_LIT>' ) <EOL> self . assertTemplateUsed ( res , '<STR_LIT>' <EOL> % self . DASHBOARD ) <EOL> self . assertTemplateUsed ( res , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( len ( res . context [ '<STR_LIT>' ] . data ) , <NUM_LIT:0> ) <EOL> @ test . create_stubs ( { api . neutron : ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_add_vpnservice_get ( self ) : <EOL> subnet = self . subnets . first ( ) <EOL> networks = [ { '<STR_LIT>' : [ subnet , ] } , ] <EOL> api . neutron . network_list_for_tenant ( <EOL> IsA ( http . HttpRequest ) , subnet . tenant_id ) . AndReturn ( networks ) <EOL> routers = self . routers . list ( ) <EOL> api . neutron . router_list ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( routers ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( reverse ( self . ADDVPNSERVICE_PATH ) ) <EOL> workflow = res . context [ '<STR_LIT>' ] <EOL> self . assertTemplateUsed ( res , views . WorkflowView . template_name ) <EOL> self . assertEqual ( workflow . name , workflows . AddVPNService . name ) <EOL> expected_objs = [ '<STR_LIT>' , ] <EOL> self . assertQuerysetEqual ( workflow . steps , expected_objs ) <EOL> @ test . create_stubs ( { api . neutron : ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) , <EOL> api . vpn : ( '<STR_LIT>' , ) } ) <EOL> def test_add_vpnservice_post ( self ) : <EOL> vpnservice = self . vpnservices . first ( ) <EOL> routers = self . routers . list ( ) <EOL> api . neutron . router_list ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( routers ) <EOL> subnet = self . subnets . first ( ) <EOL> networks = [ { '<STR_LIT>' : [ subnet , ] } , ] <EOL> api . neutron . network_list_for_tenant ( <EOL> IsA ( http . HttpRequest ) , subnet . tenant_id ) . AndReturn ( networks ) <EOL> api . vpn . vpnservice_create ( <EOL> IsA ( http . HttpRequest ) , <EOL> name = vpnservice . name , <EOL> description = vpnservice . description , <EOL> subnet_id = vpnservice . subnet_id , <EOL> router_id = vpnservice . router_id , <EOL> admin_state_up = vpnservice . admin_state_up ) . AndReturn ( <EOL> api . vpn . VPNService ( vpnservice ) ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : vpnservice [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : vpnservice [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : vpnservice [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : vpnservice [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : vpnservice [ '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDVPNSERVICE_PATH ) , form_data ) <EOL> self . assertNoFormErrors ( res ) <EOL> self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) ) <EOL> @ test . create_stubs ( { api . neutron : ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_add_vpnservice_post_error ( self ) : <EOL> vpnservice = self . vpnservices . first ( ) <EOL> routers = self . routers . list ( ) <EOL> api . neutron . router_list ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( routers ) <EOL> subnet = self . subnets . first ( ) <EOL> networks = [ { '<STR_LIT>' : [ subnet , ] } , ] <EOL> api . neutron . network_list_for_tenant ( <EOL> IsA ( http . HttpRequest ) , subnet . tenant_id ) . AndReturn ( networks ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : vpnservice [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : vpnservice [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : vpnservice [ '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDVPNSERVICE_PATH ) , form_data ) <EOL> self . assertFormErrors ( res , <NUM_LIT:2> ) <EOL> def test_add_ikepolicy_get ( self ) : <EOL> res = self . client . get ( reverse ( self . ADDIKEPOLICY_PATH ) ) <EOL> workflow = res . context [ '<STR_LIT>' ] <EOL> self . assertTemplateUsed ( res , views . WorkflowView . template_name ) <EOL> self . assertEqual ( workflow . name , workflows . AddIKEPolicy . name ) <EOL> expected_objs = [ '<STR_LIT>' , ] <EOL> self . assertQuerysetEqual ( workflow . steps , expected_objs ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , ) } ) <EOL> def test_add_ikepolicy_post ( self ) : <EOL> ikepolicy = self . ikepolicies . first ( ) <EOL> api . vpn . ikepolicy_create ( <EOL> IsA ( http . HttpRequest ) , <EOL> name = ikepolicy . name , <EOL> description = ikepolicy . description , <EOL> auth_algorithm = ikepolicy . auth_algorithm , <EOL> encryption_algorithm = ikepolicy . encryption_algorithm , <EOL> ike_version = ikepolicy . ike_version , <EOL> lifetime = ikepolicy . lifetime , <EOL> phase1_negotiation_mode = ikepolicy . phase1_negotiation_mode , <EOL> pfs = ikepolicy . pfs ) . AndReturn ( <EOL> api . vpn . IKEPolicy ( ikepolicy ) ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : ikepolicy [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ikepolicy [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] [ '<STR_LIT:value>' ] , <EOL> '<STR_LIT>' : ikepolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDIKEPOLICY_PATH ) , form_data ) <EOL> self . assertNoFormErrors ( res ) <EOL> self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) ) <EOL> def test_add_ikepolicy_post_error ( self ) : <EOL> ikepolicy = self . ikepolicies . first ( ) <EOL> form_data = { '<STR_LIT:name>' : ikepolicy [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ikepolicy [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : ikepolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ikepolicy [ '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDIKEPOLICY_PATH ) , form_data ) <EOL> self . assertFormErrors ( res , <NUM_LIT:1> ) <EOL> def test_add_ipsecpolicy_get ( self ) : <EOL> res = self . client . get ( reverse ( self . ADDIPSECPOLICY_PATH ) ) <EOL> workflow = res . context [ '<STR_LIT>' ] <EOL> self . assertTemplateUsed ( res , views . WorkflowView . template_name ) <EOL> self . assertEqual ( workflow . name , workflows . AddIPSecPolicy . name ) <EOL> expected_objs = [ '<STR_LIT>' , ] <EOL> self . assertQuerysetEqual ( workflow . steps , expected_objs ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , ) } ) <EOL> def test_add_ipsecpolicy_post ( self ) : <EOL> ipsecpolicy = self . ipsecpolicies . first ( ) <EOL> api . vpn . ipsecpolicy_create ( <EOL> IsA ( http . HttpRequest ) , <EOL> name = ipsecpolicy . name , <EOL> description = ipsecpolicy . description , <EOL> auth_algorithm = ipsecpolicy . auth_algorithm , <EOL> encryption_algorithm = ipsecpolicy . encryption_algorithm , <EOL> encapsulation_mode = ipsecpolicy . encapsulation_mode , <EOL> lifetime = ipsecpolicy . lifetime , <EOL> pfs = ipsecpolicy . pfs , <EOL> transform_protocol = ipsecpolicy . transform_protocol ) . AndReturn ( <EOL> api . vpn . IPSecPolicy ( ipsecpolicy ) ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : ipsecpolicy [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ipsecpolicy [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] [ '<STR_LIT:value>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDIPSECPOLICY_PATH ) , form_data ) <EOL> self . assertNoFormErrors ( res ) <EOL> self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) ) <EOL> def test_add_ipsecpolicy_post_error ( self ) : <EOL> ipsecpolicy = self . ipsecpolicies . first ( ) <EOL> form_data = { '<STR_LIT:name>' : ipsecpolicy [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ipsecpolicy [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : ipsecpolicy [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecpolicy [ <EOL> '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDIPSECPOLICY_PATH ) , form_data ) <EOL> self . assertFormErrors ( res , <NUM_LIT:1> ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_add_ipsecsiteconnection_get ( self ) : <EOL> ikepolicies = self . ikepolicies . list ( ) <EOL> api . vpn . ikepolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ikepolicies ) <EOL> ipsecpolicies = self . ipsecpolicies . list ( ) <EOL> api . vpn . ipsecpolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ipsecpolicies ) <EOL> vpnservices = self . vpnservices . list ( ) <EOL> api . vpn . vpnservices_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( vpnservices ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( reverse ( self . ADDVPNCONNECTION_PATH ) ) <EOL> workflow = res . context [ '<STR_LIT>' ] <EOL> self . assertTemplateUsed ( res , views . WorkflowView . template_name ) <EOL> self . assertEqual ( workflow . name , workflows . AddIPSecSiteConnection . name ) <EOL> expected_objs = [ '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , ] <EOL> self . assertQuerysetEqual ( workflow . steps , expected_objs ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_add_ipsecsiteconnection_post ( self ) : <EOL> ipsecsiteconnection = self . ipsecsiteconnections . first ( ) <EOL> ikepolicies = self . ikepolicies . list ( ) <EOL> api . vpn . ikepolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ikepolicies ) <EOL> ipsecpolicies = self . ipsecpolicies . list ( ) <EOL> api . vpn . ipsecpolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ipsecpolicies ) <EOL> vpnservices = self . vpnservices . list ( ) <EOL> api . vpn . vpnservices_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( vpnservices ) <EOL> api . vpn . ipsecsiteconnection_create ( <EOL> IsA ( http . HttpRequest ) , <EOL> name = ipsecsiteconnection . name , <EOL> description = ipsecsiteconnection . description , <EOL> dpd = ipsecsiteconnection . dpd , <EOL> ikepolicy_id = ipsecsiteconnection . ikepolicy_id , <EOL> initiator = ipsecsiteconnection . initiator , <EOL> ipsecpolicy_id = ipsecsiteconnection . ipsecpolicy_id , <EOL> mtu = ipsecsiteconnection . mtu , <EOL> peer_address = ipsecsiteconnection . peer_address , <EOL> peer_cidrs = ipsecsiteconnection . peer_cidrs , <EOL> peer_id = ipsecsiteconnection . peer_id , <EOL> psk = ipsecsiteconnection . psk , <EOL> vpnservice_id = ipsecsiteconnection . vpnservice_id , <EOL> admin_state_up = ipsecsiteconnection . admin_state_up ) . AndReturn ( <EOL> api . vpn . IPSecSiteConnection ( ipsecsiteconnection ) ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : ipsecsiteconnection [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ipsecsiteconnection [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT:action>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ <EOL> '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ <EOL> '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDVPNCONNECTION_PATH ) , form_data ) <EOL> self . assertNoFormErrors ( res ) <EOL> self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) ) <EOL> @ test . create_stubs ( { api . vpn : ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) } ) <EOL> def test_add_ipsecsiteconnection_post_error ( self ) : <EOL> ipsecsiteconnection = self . ipsecsiteconnections . first ( ) <EOL> ikepolicies = self . ikepolicies . list ( ) <EOL> api . vpn . ikepolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ikepolicies ) <EOL> ipsecpolicies = self . ipsecpolicies . list ( ) <EOL> api . vpn . ipsecpolicies_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( ipsecpolicies ) <EOL> vpnservices = self . vpnservices . list ( ) <EOL> api . vpn . vpnservices_get ( <EOL> IsA ( http . HttpRequest ) ) . AndReturn ( vpnservices ) <EOL> self . mox . ReplayAll ( ) <EOL> form_data = { '<STR_LIT:name>' : ipsecsiteconnection [ '<STR_LIT:name>' ] , <EOL> '<STR_LIT:description>' : ipsecsiteconnection [ '<STR_LIT:description>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT:action>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ipsecsiteconnection [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ipsecsiteconnection [ <EOL> '<STR_LIT>' ] } <EOL> res = self . client . post ( reverse ( self . ADDVPNCONNECTION_PATH ) , form_data ) <EOL> self . assertFormErrors ( res , <NUM_LIT:3> ) </s>
