Exemplo n.º 1
0
 def test_buyer(self):
     buyer = Buyer.objects.create(uuid="sample:uid")
     data = self.get_data()
     data["buyer"] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data["preapproval"], "")
Exemplo n.º 2
0
 def test_buyer(self):
     buyer = Buyer.objects.create(uuid='sample:uid')
     data = self.get_data()
     data['buyer'] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 3
0
 def test_buyer(self):
     buyer = Buyer.objects.create(uuid='sample:uid')
     data = self.get_data()
     data['buyer'] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 4
0
 def test_duplicate_uuid(self):
     PaypalTransaction.objects.create(seller=self.paypal, amount=5,
                                      uuid='sample:uuid')
     data = self.get_data()
     data['uuid'] = 'sample:uuid'
     form = PayValidation(data)
     assert not form.is_valid(), form.errors
Exemplo n.º 5
0
 def test_duplicate_uuid(self):
     Transaction.objects.create(seller=self.paypal,
                                amount=5,
                                uuid='sample:uuid')
     data = self.get_data()
     data['uuid'] = 'sample:uuid'
     form = PayValidation(data)
     assert not form.is_valid(), form.errors
Exemplo n.º 6
0
 def test_buyer_preapproval_ignored(self):
     buyer = Buyer.objects.create(uuid='sample:uid')
     BuyerPaypal.objects.create(buyer=buyer, key='foo')
     data = self.get_data()
     data['use_preapproval'] = False
     data['buyer'] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 7
0
 def test_buyer_preapproval_ignored(self):
     buyer = Buyer.objects.create(uuid="sample:uid")
     BuyerPaypal.objects.create(buyer=buyer, key="foo")
     data = self.get_data()
     data["use_preapproval"] = False
     data["buyer"] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data["preapproval"], "")
Exemplo n.º 8
0
 def test_buyer_preapproval_ignored(self):
     buyer = Buyer.objects.create(uuid='sample:uid')
     BuyerPaypal.objects.create(buyer=buyer, key='foo')
     data = self.get_data()
     data['use_preapproval'] = False
     data['buyer'] = buyer.uuid
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 9
0
    def obj_create(self, bundle, request, **kwargs):
        form = PayValidation(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        paypal = get_client()
        # TODO: there might be a lot more we can do here.
        bundle.data = paypal.get_pay_key(*form.args(), **form.kwargs())
        create.send(sender=self, bundle=bundle, form=form.cleaned_data)
        return bundle
Exemplo n.º 10
0
    def obj_create(self, bundle, request, **kwargs):
        form = PayValidation(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        paypal = get_client()
        # TODO: there might be a lot more we can do here.
        bundle.data = paypal.get_pay_key(*form.args(), **form.kwargs())
        create.send(sender=self, bundle=bundle, form=form.cleaned_data)
        return bundle
Exemplo n.º 11
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['currency'], 'USD')
Exemplo n.º 12
0
 def test_buyer_optional(self):
     data = self.get_data()
     data['buyer'] = 'not:there:uid'
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 13
0
 def test_buyer_optional(self):
     data = self.get_data()
     data['buyer'] = 'not:there:uid'
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data['preapproval'], '')
Exemplo n.º 14
0
 def test_seller(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['seller_email'], '*****@*****.**')
Exemplo n.º 15
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data["currency"], "USD")
Exemplo n.º 16
0
 def test_seller(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['seller_email'], '*****@*****.**')
Exemplo n.º 17
0
 def test_buyer_optional(self):
     data = self.get_data()
     data["buyer"] = "not:there:uid"
     form = PayValidation(data)
     assert form.is_valid(), form.errors
     eq_(form.cleaned_data["preapproval"], "")
Exemplo n.º 18
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['currency'], 'USD')