#NEWLINE# def test_ajax_saves_address( self ) : #NEWLINE# #INDENT# self . assertEquals ( Address . objects . count ( ) , 2 ) #NEWLINE# registration_response = self . client . post ( reverse ( 'lfs_login' ) , { #NEWLINE# #INDENT# 'action' : 'register' , #NEWLINE# 'email' : 'test@test.com' , #NEWLINE# 'password_1' : 'password' , #NEWLINE# 'password_2' : 'password' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEquals ( registration_response . status_code , 302 ) #NEWLINE# self . assertEquals ( registration_response . _headers [ 'location' ] , ( 'Location' , 'http://testserver/' ) ) #NEWLINE# our_customer = Customer . objects . get ( user__email = 'test@test.com' ) #NEWLINE# self . assertNotEqual ( our_customer , None ) #NEWLINE# self . assertNotEqual ( our_customer . selected_invoice_address , None ) #NEWLINE# self . assertNotEqual ( our_customer . selected_shipping_address , None ) #NEWLINE# self . assertNotEqual ( our_customer . default_invoice_address , None ) #NEWLINE# self . assertNotEqual ( our_customer . default_shipping_address , None ) #NEWLINE# self . assertEquals ( Address . objects . count ( ) , 6 ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'invoice-country' : 'ie' , #NEWLINE# #UNINDENT# } #NEWLINE# ajax_respons = self . client . post ( reverse ( 'lfs_changed_invoice_country' ) , form_data ) #NEWLINE# self . assertEquals ( Address . objects . count ( ) , 6 ) #NEWLINE# our_customer = Customer . objects . get ( user__email = 'test@test.com' ) #NEWLINE# self . assertNotEqual ( our_customer . selected_invoice_address , None ) #NEWLINE# self . assertNotEqual ( our_customer . selected_shipping_address , None ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'invoice-line1' : 'my house' , #NEWLINE# 'invoice-line2' : 'a street' , #NEWLINE# 'invoice-city' : 'a city' , #NEWLINE# 'invoice-code' : 'a code' , #NEWLINE# 'invoice-state' : 'a state' , #NEWLINE# 'invoice-country' : 'ie' , #NEWLINE# #UNINDENT# } #NEWLINE# ajax_respons = self . client . post ( reverse ( 'lfs_changed_invoice_country' ) , form_data ) #NEWLINE# self . assertEquals ( Address . objects . count ( ) , 6 ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'shipping-line1' : 'de missusesss house' , #NEWLINE# 'shipping-country' : 'ie' , #NEWLINE# #UNINDENT# } #NEWLINE# ajax_respons = self . client . post ( reverse ( 'lfs_changed_shipping_country' ) , form_data ) #NEWLINE# self . assertEquals ( Address . objects . count ( ) , 6 ) #NEWLINE# our_customer = Customer . objects . get ( user__email = 'test@test.com' ) #NEWLINE# self . assertNotEqual ( our_customer . selected_invoice_address , None ) #NEWLINE# self . assertNotEqual ( our_customer . selected_shipping_address , None ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'shipping-firstname' : 'charlize' , #NEWLINE# 'shipping-line2' : 'a street' , #NEWLINE# 'shipping-city' : 'a city' , #NEWLINE# 'shipping-code' : 'a code' , #NEWLINE# 'shipping-state' : 'a state' , #NEWLINE# 'shipping-country' : 'ie' , #NEWLINE# #UNINDENT# } #NEWLINE# ajax_respons = self . client . post ( reverse ( 'lfs_changed_shipping_country' ) , form_data ) #NEWLINE# self . assertEquals ( Address . objects . count ( ) , 6 )