<s> import sys <EOL> from neutronclient . common import exceptions <EOL> from neutronclient . neutron . v2_0 . vpn import ipsecpolicy <EOL> from neutronclient . tests . unit import test_cli20 <EOL> class CLITestV20VpnIpsecPolicyJSON ( test_cli20 . CLITestV20Base ) : <EOL> non_admin_status_resources = [ '<STR_LIT>' ] <EOL> def test_create_ipsecpolicy_all_params ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . CreateIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> name = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> auth_algorithm = '<STR_LIT>' <EOL> encryption_algorithm = '<STR_LIT>' <EOL> encapsulation_mode = '<STR_LIT>' <EOL> pfs = '<STR_LIT>' <EOL> transform_protocol = '<STR_LIT>' <EOL> tenant_id = '<STR_LIT>' <EOL> my_id = '<STR_LIT>' <EOL> lifetime = '<STR_LIT>' <EOL> args = [ name , <EOL> '<STR_LIT>' , description , <EOL> '<STR_LIT>' , tenant_id , <EOL> '<STR_LIT>' , auth_algorithm , <EOL> '<STR_LIT>' , encryption_algorithm , <EOL> '<STR_LIT>' , transform_protocol , <EOL> '<STR_LIT>' , encapsulation_mode , <EOL> '<STR_LIT>' , lifetime , <EOL> '<STR_LIT>' , pfs ] <EOL> position_names = [ '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT:description>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> position_values = [ name , auth_algorithm , encryption_algorithm , <EOL> encapsulation_mode , description , <EOL> transform_protocol , pfs , <EOL> tenant_id ] <EOL> extra_body = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : <NUM_LIT> , <EOL> } , <EOL> } <EOL> self . _test_create_resource ( resource , cmd , name , my_id , args , <EOL> position_names , position_values , <EOL> extra_body = extra_body ) <EOL> def test_create_ipsecpolicy_with_limited_params ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . CreateIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> name = '<STR_LIT>' <EOL> auth_algorithm = '<STR_LIT>' <EOL> encryption_algorithm = '<STR_LIT>' <EOL> encapsulation_mode = '<STR_LIT>' <EOL> pfs = '<STR_LIT>' <EOL> transform_protocol = '<STR_LIT>' <EOL> tenant_id = '<STR_LIT>' <EOL> my_id = '<STR_LIT>' <EOL> args = [ name , <EOL> '<STR_LIT>' , tenant_id ] <EOL> position_names = [ '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> position_values = [ name , auth_algorithm , encryption_algorithm , <EOL> encapsulation_mode , <EOL> transform_protocol , pfs , <EOL> tenant_id ] <EOL> self . _test_create_resource ( resource , cmd , name , my_id , args , <EOL> position_names , position_values ) <EOL> def _test_lifetime_values ( self , lifetime , expected_exc = None ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . CreateIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> name = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> auth_algorithm = '<STR_LIT>' <EOL> encryption_algorithm = '<STR_LIT>' <EOL> ike_version = '<STR_LIT>' <EOL> phase1_negotiation_mode = '<STR_LIT>' <EOL> pfs = '<STR_LIT>' <EOL> tenant_id = '<STR_LIT>' <EOL> my_id = '<STR_LIT>' <EOL> args = [ name , <EOL> '<STR_LIT>' , description , <EOL> '<STR_LIT>' , tenant_id , <EOL> '<STR_LIT>' , auth_algorithm , <EOL> '<STR_LIT>' , encryption_algorithm , <EOL> '<STR_LIT>' , ike_version , <EOL> '<STR_LIT>' , phase1_negotiation_mode , <EOL> '<STR_LIT>' , lifetime , <EOL> '<STR_LIT>' , pfs ] <EOL> position_names = [ '<STR_LIT:name>' , '<STR_LIT:description>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> position_values = [ name , description , <EOL> auth_algorithm , encryption_algorithm , <EOL> phase1_negotiation_mode , ike_version , pfs , <EOL> tenant_id ] <EOL> if not expected_exc : <EOL> expected_exc = exceptions . CommandError <EOL> self . assertRaises ( <EOL> expected_exc , <EOL> self . _test_create_resource , <EOL> resource , cmd , name , my_id , args , <EOL> position_names , position_values ) <EOL> def test_create_ipsecpolicy_with_invalid_lifetime_keys ( self ) : <EOL> lifetime = '<STR_LIT>' <EOL> self . _test_lifetime_values ( lifetime , SystemExit ) <EOL> def test_create_ipsecpolicy_with_invalid_lifetime_units ( self ) : <EOL> lifetime = '<STR_LIT>' <EOL> self . _test_lifetime_values ( lifetime ) <EOL> def test_create_ipsecpolicy_with_invalid_lifetime_value ( self ) : <EOL> lifetime = '<STR_LIT>' <EOL> self . _test_lifetime_values ( lifetime ) <EOL> def test_list_ipsecpolicy ( self ) : <EOL> resources = "<STR_LIT>" <EOL> cmd = ipsecpolicy . ListIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> self . _test_list_resources ( resources , cmd , True ) <EOL> def test_list_ipsecpolicy_pagination ( self ) : <EOL> resources = "<STR_LIT>" <EOL> cmd = ipsecpolicy . ListIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> self . _test_list_resources_with_pagination ( resources , cmd ) <EOL> def test_list_ipsecpolicy_sort ( self ) : <EOL> resources = "<STR_LIT>" <EOL> cmd = ipsecpolicy . ListIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> self . _test_list_resources ( resources , cmd , <EOL> sort_key = [ "<STR_LIT:name>" , "<STR_LIT:id>" ] , <EOL> sort_dir = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def test_list_ipsecpolicy_limit ( self ) : <EOL> resources = "<STR_LIT>" <EOL> cmd = ipsecpolicy . ListIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> self . _test_list_resources ( resources , cmd , page_size = <NUM_LIT:1000> ) <EOL> def test_show_ipsecpolicy_id ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . ShowIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> args = [ '<STR_LIT>' , '<STR_LIT:id>' , self . test_id ] <EOL> self . _test_show_resource ( resource , cmd , self . test_id , args , [ '<STR_LIT:id>' ] ) <EOL> def test_show_ipsecpolicy_id_name ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . ShowIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> args = [ '<STR_LIT>' , '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT:name>' , self . test_id ] <EOL> self . _test_show_resource ( resource , cmd , self . test_id , <EOL> args , [ '<STR_LIT:id>' , '<STR_LIT:name>' ] ) <EOL> def test_update_ipsecpolicy ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . UpdateIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> self . _test_update_resource ( resource , cmd , '<STR_LIT>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , } ) <EOL> def test_delete_ipsecpolicy ( self ) : <EOL> resource = '<STR_LIT>' <EOL> cmd = ipsecpolicy . DeleteIPsecPolicy ( test_cli20 . MyApp ( sys . stdout ) , None ) <EOL> my_id = '<STR_LIT>' <EOL> args = [ my_id ] <EOL> self . _test_delete_resource ( resource , cmd , my_id , args ) </s>
