def test_keep_cart_on_login(self):
        request = self.factory.post('/shop/auth/login', follow=True)
        request.customer = Customer()
        request.customer.save()
        request.session = {'session_key': 'keep_cart'}
        request.user = self.bart
        old_cart = Cart.objects.get_from_request(request)
        user_logged_in.send(sender=self.bart.__class__, request=request, user=self.bart)
        new_cart = Cart.objects.get_from_request(request)
        self.assertEqual(new_cart.customer, request.customer)
        self.assertEqual(new_cart, old_cart)
Test that when logging in, an existing cart's Customer reference is set
dataset/ETHPy150Open awesto/django-shop/testshop/skip_test_customer.py/CustomerTest.test_keep_cart_on_login