<s> from oslo_serialization import jsonutils <EOL> from novaclient . tests . unit import fakes <EOL> from novaclient . tests . unit . fixture_data import base <EOL> class FloatingFixture ( base . Fixture ) : <EOL> base_url = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> super ( FloatingFixture , self ) . setUp ( ) <EOL> floating_ips = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } ] <EOL> get_os_floating_ips = { '<STR_LIT>' : floating_ips } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( ) , <EOL> json = get_os_floating_ips , <EOL> headers = self . json_headers ) <EOL> for ip in floating_ips : <EOL> get_os_floating_ip = { '<STR_LIT>' : ip } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( ip [ '<STR_LIT:id>' ] ) , <EOL> json = get_os_floating_ip , <EOL> headers = self . json_headers ) <EOL> self . requests . register_uri ( '<STR_LIT>' , self . url ( ip [ '<STR_LIT:id>' ] ) , <EOL> headers = self . json_headers , <EOL> status_code = <NUM_LIT> ) <EOL> def post_os_floating_ips ( request , context ) : <EOL> body = jsonutils . loads ( request . body ) <EOL> ip = floating_ips [ <NUM_LIT:0> ] . copy ( ) <EOL> ip [ '<STR_LIT>' ] = body . get ( '<STR_LIT>' ) <EOL> return { '<STR_LIT>' : ip } <EOL> self . requests . register_uri ( '<STR_LIT:POST>' , self . url ( ) , <EOL> json = post_os_floating_ips , <EOL> headers = self . json_headers ) <EOL> class DNSFixture ( base . Fixture ) : <EOL> base_url = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> super ( DNSFixture , self ) . setUp ( ) <EOL> get_os_floating_ip_dns = { <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT>' : '<STR_LIT>' } <EOL> ] <EOL> } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( ) , <EOL> json = get_os_floating_ip_dns , <EOL> headers = self . json_headers , <EOL> status_code = <NUM_LIT> ) <EOL> get_dns_testdomain_entries_testname = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:type>' : "<STR_LIT:A>" , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } <EOL> url = self . url ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , url , <EOL> json = get_dns_testdomain_entries_testname , <EOL> headers = self . json_headers , <EOL> status_code = <NUM_LIT> ) <EOL> self . requests . register_uri ( '<STR_LIT>' , self . url ( '<STR_LIT>' ) , <EOL> headers = self . json_headers ) <EOL> url = self . url ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . requests . register_uri ( '<STR_LIT>' , url , headers = self . json_headers ) <EOL> def put_dns_testdomain_entries_testname ( request , context ) : <EOL> body = jsonutils . loads ( request . body ) <EOL> fakes . assert_has_keys ( body [ '<STR_LIT>' ] , <EOL> required = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> context . status_code = <NUM_LIT> <EOL> return request . body <EOL> self . requests . register_uri ( '<STR_LIT>' , url , <EOL> text = put_dns_testdomain_entries_testname , <EOL> headers = self . json_headers ) <EOL> url = self . url ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , url , status_code = <NUM_LIT> ) <EOL> get_os_floating_ip_dns_testdomain = { <EOL> '<STR_LIT>' : [ <EOL> { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : "<STR_LIT>" , <EOL> '<STR_LIT:type>' : "<STR_LIT:A>" , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } , <EOL> { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : "<STR_LIT>" , <EOL> '<STR_LIT:type>' : "<STR_LIT:A>" , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } , <EOL> ] <EOL> } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , url + '<STR_LIT>' , <EOL> json = get_os_floating_ip_dns_testdomain , <EOL> status_code = <NUM_LIT> , <EOL> headers = self . json_headers ) <EOL> def put_os_floating_ip_dns_testdomain ( request , context ) : <EOL> body = jsonutils . loads ( request . body ) <EOL> if body [ '<STR_LIT>' ] [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> fakes . assert_has_keys ( body [ '<STR_LIT>' ] , <EOL> required = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> elif body [ '<STR_LIT>' ] [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> fakes . assert_has_keys ( body [ '<STR_LIT>' ] , <EOL> required = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> else : <EOL> fakes . assert_has_keys ( body [ '<STR_LIT>' ] , <EOL> required = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> return request . body <EOL> self . requests . register_uri ( '<STR_LIT>' , self . url ( '<STR_LIT>' ) , <EOL> text = put_os_floating_ip_dns_testdomain , <EOL> status_code = <NUM_LIT> , <EOL> headers = self . json_headers ) <EOL> class BulkFixture ( base . Fixture ) : <EOL> base_url = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> super ( BulkFixture , self ) . setUp ( ) <EOL> get_os_floating_ips_bulk = { <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , <EOL> ] <EOL> } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( ) , <EOL> json = get_os_floating_ips_bulk , <EOL> headers = self . json_headers ) <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( '<STR_LIT>' ) , <EOL> json = get_os_floating_ips_bulk , <EOL> headers = self . json_headers ) <EOL> def put_os_floating_ips_bulk_delete ( request , context ) : <EOL> body = jsonutils . loads ( request . body ) <EOL> ip_range = body . get ( '<STR_LIT>' ) <EOL> return { '<STR_LIT>' : ip_range } <EOL> self . requests . register_uri ( '<STR_LIT>' , self . url ( '<STR_LIT>' ) , <EOL> json = put_os_floating_ips_bulk_delete , <EOL> headers = self . json_headers ) <EOL> def post_os_floating_ips_bulk ( request , context ) : <EOL> body = jsonutils . loads ( request . body ) <EOL> params = body . get ( '<STR_LIT>' ) <EOL> pool = params . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> interface = params . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> return { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : pool , <EOL> '<STR_LIT>' : interface <EOL> } <EOL> } <EOL> self . requests . register_uri ( '<STR_LIT:POST>' , self . url ( ) , <EOL> json = post_os_floating_ips_bulk , <EOL> headers = self . json_headers ) <EOL> class PoolsFixture ( base . Fixture ) : <EOL> base_url = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> super ( PoolsFixture , self ) . setUp ( ) <EOL> get_os_floating_ip_pools = { <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT:name>' : '<STR_LIT:foo>' } , <EOL> { '<STR_LIT:name>' : '<STR_LIT:bar>' } <EOL> ] <EOL> } <EOL> self . requests . register_uri ( '<STR_LIT:GET>' , self . url ( ) , <EOL> json = get_os_floating_ip_pools , <EOL> headers = self . json_headers ) </s>
