#NEWLINE# def test_extended_create( self ) : #NEWLINE# #INDENT# net_id = _uuid ( ) #NEWLINE# initial_input = { #NEWLINE# #INDENT# 'network' : { #NEWLINE# #INDENT# 'name' : 'net1' , #NEWLINE# 'tenant_id' : _uuid ( ) , #NEWLINE# 'v2attrs:something_else' : 'abc' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# data = { #NEWLINE# #INDENT# 'network' : { #NEWLINE# #INDENT# 'admin_state_up' : True , #NEWLINE# 'shared' : False , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# data [ 'network' ] . update ( initial_input [ 'network' ] ) #NEWLINE# return_value = { #NEWLINE# #INDENT# 'subnets' : [ ] , #NEWLINE# 'status' : 'ACTIVE' , #NEWLINE# 'id' : net_id , #NEWLINE# 'v2attrs:something' : '123' , #NEWLINE# #UNINDENT# } #NEWLINE# return_value . update ( data [ 'network' ] . copy ( ) ) #NEWLINE# instance = self . plugin . return_value #NEWLINE# instance . create_network . return_value = return_value #NEWLINE# instance . get_networks_count . return_value = 0 #NEWLINE# res = self . api . post_json ( _get_path ( 'networks' ) , initial_input ) #NEWLINE# instance . create_network . assert_called_with ( mock . ANY , network = data ) #NEWLINE# self . assertEqual ( exc . HTTPCreated . code , res . status_int ) #NEWLINE# self . assertIn ( 'network' , res . json ) #NEWLINE# net = res . json [ 'network' ] #NEWLINE# self . assertEqual ( net , net [ 'id' ] ) #NEWLINE# self . assertEqual ( 'ACTIVE' , net [ 'status' ] ) #NEWLINE# self . assertEqual ( '123' , net [ 'v2attrs:something' ] ) #NEWLINE# self . assertNotIn ( 'v2attrs:something_else' , net )