예제 #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"], "")
예제 #2
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
예제 #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'], '')
예제 #4
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'], '')
예제 #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
예제 #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'], '')
예제 #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"], "")
예제 #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'], '')
예제 #9
0
파일: pay.py 프로젝트: pombredanne/solitude
    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
예제 #10
0
파일: pay.py 프로젝트: AltisCorp/solitude
    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
예제 #11
0
 def test_seller(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['seller_email'], '*****@*****.**')
예제 #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'], '')
예제 #13
0
 def test_no_seller(self):
     data = self.get_data()
     data['seller'] = 'foo'
     assert not PayValidation(data).is_valid()
예제 #14
0
 def test_seller(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['seller_email'], '*****@*****.**')
예제 #15
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data["currency"], "USD")
예제 #16
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'], '')
예제 #17
0
 def test_empty_paypal(self):
     self.paypal.paypal_id = ''
     self.paypal.save()
     assert not PayValidation(self.get_data()).is_valid()
예제 #18
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['currency'], 'USD')
예제 #19
0
 def test_currency(self):
     form = PayValidation(self.get_data())
     assert form.is_valid()
     eq_(form.cleaned_data['currency'], 'USD')
예제 #20
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"], "")
예제 #21
0
 def test_no_paypal(self):
     self.paypal.delete()
     assert not PayValidation(self.get_data()).is_valid()