Esempio n. 1
0
    def login(self, group=None):
        self.user = VokoUserFactory.create()
        self.user.set_password('secret')
        self.user.is_active = True
        self.user.save()

        if group:
            g = Group.objects.create(name=group)
            g.user_set.add(self.user)

        self.client.login(username=self.user.email, password='******')
Esempio n. 2
0
    def login(self, group=None):
        self.user = VokoUserFactory.create()
        self.user.set_password('secret')
        self.user.is_active = True
        self.user.save()

        if group:
            g = Group.objects.create(name=group)
            g.user_set.add(self.user)

        self.client.login(username=self.user.email, password='******')
Esempio n. 3
0
    def setUp(self):
        self.url = reverse('finance.cancelpayment')

        self.user = VokoUserFactory.create()
        self.user.set_password('secret')
        self.user.is_active = True
        self.user.save()
        self.client.login(username=self.user.email, password='******')

        self.order = OrderFactory(user=self.user,
                                  finalized=True,
                                  paid=False)
Esempio n. 4
0
    def setUp(self):
        self.url = reverse("finance.cancelpayment")

        self.user = VokoUserFactory.create()
        self.user.set_password("secret")
        self.user.is_active = True
        self.user.save()
        self.client.login(username=self.user.email, password="******")

        self.order = OrderFactory(user=self.user, finalized=True, paid=False)

        s = self.client.session
        s["order_to_pay"] = self.order.id
        s.save()
Esempio n. 5
0
    def setUp(self):
        self.mollie = self.patch("finance.views.Mollie")
        self.mollie_client = self.mollie. \
            API.Client
        self.mollie_client.return_value.issuers.all.return_value = \
            MagicMock()
        self.mollie.API.Object.Method.IDEAL = 'ideal'

        issuers = {"data": [
            {'id': 'EXAMPLE_BANK', 'name': "Example Bank", 'method': 'ideal'},
            {'id': 'ANOTHER_BANK', 'name': "Another Bank", 'method': 'ideal'},
            {'id': 'NON_IDEAL_BANK',
             'name': "Non iDeal Bank",
             'method': 'bla'},
        ]}
        self.mollie_client.return_value.issuers.all.return_value = issuers

        self.user = VokoUserFactory.create()
        self.user.set_password('secret')
        self.user.is_active = True
        self.user.save()
        self.client.login(username=self.user.email, password='******')

        self.mock_create_credit = self.patch(
            "finance.models.Payment.create_and_link_credit")
        self.mock_mail_confirmation = self.patch(
            "ordering.models.Order.mail_confirmation")
        self.mock_failure_notification = self.patch(
            "ordering.models.Order.mail_failure_notification")
        # TODO figure out why this mock breaks all ConfirmTransaction tests
        # self.mock_complete_after_payment = self.patch(
        #     "ordering.models.Order.complete_after_payment")

        class FakePaymentResult(object):
            def __getitem__(self, item):
                if item == "id":
                    return "transaction_id"

            def getPaymentUrl(self):
                return "http://bank.url"

        self.mollie_client.return_value.payments.create.return_value = (
            FakePaymentResult())