#NEWLINE# def test_update_byaddress_not_allowed( self , mock_upd ) : #NEWLINE# #INDENT# extra = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } #NEWLINE# mock_upd . return_value = self . port #NEWLINE# mock_upd . return_value . extra = extra #NEWLINE# response = self . patch_json ( ( '/ports/%s' % self . port . address ) , [ { #NEWLINE# #INDENT# 'path' : '/extra/foo' , #NEWLINE# 'value' : 'bar' , #NEWLINE# 'op' : 'add' , #NEWLINE# #UNINDENT# } ] , expect_errors = True ) #NEWLINE# self . assertEqual ( 'application/json' , response . content_type ) #NEWLINE# self . assertEqual ( http_client . BAD_REQUEST , response . status_int ) #NEWLINE# self . assertIn ( self . port . address , response . json [ 'error_message' ] ) #NEWLINE# self . assertFalse ( mock_upd . called )