def test_trustcommerce_form_save_credit_number(self): """ Test that method save last four number or credit cart """ wizard = PrePaymentWizard() request = RequestFactory().get('/') request.session = {} wizard.request = request cart = model_factory(Cart, save=True) wizard.order = model_factory(Order, cart=cart) form = TrustCommercePaymentForm() form.cleaned_data = FORM_CLEANED_DATA order = form.save(wizard) self.assertEqual(order.card_number, '1111')
def test_trustcommerce_form_save_session(self): """ Test that method set data in session """ expected_dict = PAYMENT_INFO_IN_SESSION.copy() wizard = PrePaymentWizard() request = RequestFactory().get('/') request.session = {} wizard.request = request cart = model_factory(Cart, save=True) wizard.order = model_factory(Order, cart=cart, save=True) form = TrustCommercePaymentForm() form.cleaned_data = FORM_CLEANED_DATA form.save(wizard) self.assertEqual(expected_dict, request.session)