Beispiel #1
0
 def test_remove_payment_form_if_change(self):
     """
     Test that method remove payment form from wizard if payment method
     change
     """
     last_form = Mock()
     form_list = {'0': Mock(), '1': Mock(), '2': last_form}
     request = RequestFactory().post('/', {'payment_method': 'paypal'})
     request.session = {'module_name': 'dummy'}
     wizard = PrePaymentWizard()
     wizard.form_list = form_list
     wizard.request = request
     wizard.remove_payment_form_if_change()
     self.assertFalse(last_form in wizard.form_list)
Beispiel #2
0
 def test_wizard_add_paymet_form_method(self):
     """
     Test that method add payment form to wizard from payment module
     """
     request = RequestFactory().post('/', {'payment_method': 'dummy'})
     request.session = {}
     form_with_method_name = Mock(data={'payment_method': 'dummy'})
     form_list = {'1': Mock(data=[]), '0': form_with_method_name}
     wizard = PrePaymentWizard()
     wizard.request = request
     wizard.steps = Mock(count=2)
     wizard.form_list = form_list
     with patch('django.conf.settings.PAYMENT_MODULES',
                             {'dummy': 'salest.payments.modules.dummy'}):
         wizard.add_paymet_form()
         self.assertIn(DummyPaymentForm, wizard.form_list.values())