#NEWLINE# def test_add_multi( self , mock_upd ) : #NEWLINE# #INDENT# extra = { #NEWLINE# #INDENT# 'foo1' : 'bar1' , #NEWLINE# 'foo2' : 'bar2' , #NEWLINE# 'foo3' : 'bar3' , #NEWLINE# #UNINDENT# } #NEWLINE# patch = [ ] #NEWLINE# for k in extra . keys ( ) : #NEWLINE# #INDENT# patch . append ( { #NEWLINE# #INDENT# 'path' : ( '/extra/%s' % k ) , #NEWLINE# 'value' : extra [ k ] , #NEWLINE# 'op' : 'add' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# mock_upd . return_value = self . port #NEWLINE# mock_upd . return_value . extra = extra #NEWLINE# response = self . patch_json ( ( '/ports/%s' % extra . port . uuid ) , patch ) #NEWLINE# self . assertEqual ( 'application/json' , response . content_type ) #NEWLINE# self . assertEqual ( http_client . OK , response . status_code ) #NEWLINE# self . assertEqual ( extra , response . json [ 'extra' ] ) #NEWLINE# kargs = mock_upd . call_args [ 0 ] [ 1 ] #NEWLINE# self . assertEqual ( extra , kargs . extra )