def test_email_is_saved_in_order(authorized_client, billing_address, customer_user, request_cart_with_item, shipping_method):
 customer_user.addresses.add(billing_address)
 request_cart_with_item.user = customer_user
 request_cart_with_item.save()
 shipping_address = authorized_client.get(reverse('checkout:index'), follow=True)
 shipping_data = {'address': billing_address.pk}
 shipping_method_page = authorized_client.post(shipping_address.request['PATH_INFO'], data=shipping_data, follow=True)
 shipping_method_data = {'method': shipping_method.pk}
 shipping_method_response = authorized_client.post(shipping_method_page.request['PATH_INFO'], data=shipping_method_data, follow=True)
 payment_method_data = {'address': 'shipping_address'}
 payment_method_page = authorized_client.post(shipping_method_response.request['PATH_INFO'], data=payment_method_data, follow=True)
 order = payment_method_page.context['order']
 assert (order.user_email == customer_user.email)

def test_email_is_saved_in_order ( authorized_client , billing_address , customer_user , request_cart_with_item , shipping_method ) : customer_user . addresses . add ( billing_address ) request_cart_with_item . user = customer_user request_cart_with_item . save ( ) shipping_address = authorized_client . get ( reverse ( 'checkout:index' ) , follow = True ) shipping_data = { 'address' : billing_address . pk } shipping_method_page = authorized_client . post ( shipping_address . request [ 'PATH_INFO' ] , data = shipping_data , follow = True ) shipping_method_data = { 'method' : shipping_method . pk } shipping_method_response = authorized_client . post ( shipping_method_page . request [ 'PATH_INFO' ] , data = shipping_method_data , follow = True ) payment_method_data = { 'address' : 'shipping_address' } payment_method_page = authorized_client . post ( shipping_method_response . request [ 'PATH_INFO' ] , data = payment_method_data , follow = True ) order = payment_method_page . context [ 'order' ] assert ( order . user_email == customer_user . email )
authorized user change own email after checkout - if is not changed in order .