#NEWLINE# def test_error_response_if_invalid( self ) : #NEWLINE# #INDENT# customer = Customer . create ( ) . customer #NEWLINE# result = Address . create ( { #NEWLINE# #INDENT# 'customer_id' : result . id , #NEWLINE# 'country_name' : 'zzzzzz' , #NEWLINE# 'country_code_alpha2' : 'zz' , #NEWLINE# 'country_code_alpha3' : 'zzz' , #NEWLINE# 'country_code_numeric' : '000' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( result . is_success ) #NEWLINE# self . assertEquals ( ErrorCodes . Address . CountryNameIsNotAccepted , result . errors . for_object ( 'address' ) . on ( 'country_name' ) [ 0 ] . code ) #NEWLINE# self . assertEquals ( ErrorCodes . Address . CountryCodeAlpha2IsNotAccepted , result . errors . for_object ( 'address' ) . on ( 'country_code_alpha2' ) [ 0 ] . code ) #NEWLINE# self . assertEquals ( ErrorCodes . Address . CountryCodeAlpha3IsNotAccepted , result . errors . for_object ( 'address' ) . on ( 'country_code_alpha3' ) [ 0 ] . code ) #NEWLINE# self . assertEquals ( ErrorCodes . Address . CountryCodeNumericIsNotAccepted , result . errors . for_object ( 'address' ) . on ( 'country_code_numeric' ) [ 0 ] . code )