Пример #1
0
 def test_reversal(self, reversal, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     reversal.return_value = True
     ipn = IPN(urllib.urlencode(samples.sample_reversal))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_OK)
Пример #2
0
 def test_chained_refund(self, refunded, post):
     post.return_value.text = 'VERIFIED'
     refunded.return_value = True
     ipn = IPN(urllib.urlencode(samples.sample_chained_refund))
     ipn.process()
     eq_(refunded.call_count, 1)
     eq_(ipn.status, constants.IPN_STATUS_OK)
Пример #3
0
 def test_reversal(self, reversal, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     reversal.return_value = True
     ipn = IPN(urllib.urlencode(samples.sample_reversal))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_OK)
Пример #4
0
 def test_purchase(self, completed, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     completed.return_value = True
     ipn = IPN(urllib.urlencode(samples.sample_purchase))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_OK)
Пример #5
0
 def test_purchase_not(self, completed, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     completed.return_value = False
     ipn = IPN(urllib.urlencode(samples.sample_purchase))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Пример #6
0
 def test_chained_refund(self, refunded, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     refunded.return_value = True
     ipn = IPN(urllib.urlencode(samples.sample_chained_refund))
     ipn.process()
     eq_(refunded.call_count, 1)
     eq_(ipn.status, constants.IPN_STATUS_OK)
Пример #7
0
    def obj_create(self, bundle, request, **kwargs):
        form = IPNForm(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        ipn = IPN(form.cleaned_data['data'])
        ipn.process()
        bundle.ipn = ipn
        return bundle
Пример #8
0
    def obj_create(self, bundle, request, **kwargs):
        form = IPNForm(bundle.data)
        if not form.is_valid():
            raise self.form_errors(form)

        ipn = IPN(form.cleaned_data['data'])
        ipn.process()
        bundle.ipn = ipn
        return bundle
Пример #9
0
 def test_calls(self, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     eq_(IPN('status=completed').is_valid(), True)
Пример #10
0
 def create(self, data):
     ipn = IPN(data)
     mock = Mock()
     mock.return_value = True
     ipn.is_valid = mock
     return ipn
Пример #11
0
 def test_not_completed(self, post):
     eq_(IPN('status=something').is_valid(), False)
Пример #12
0
 def test_not_valid(self, post):
     post.return_value.text = 'NOPE'
     post.return_value.status_code = 200
     eq_(IPN('status=completed').is_valid(), False)
Пример #13
0
 def test_empty(self, post):
     eq_(IPN('').is_valid(), False)
Пример #14
0
 def create(self, data):
     ipn = IPN(data)
     mock = Mock()
     mock.return_value = True
     ipn.is_valid = mock
     return ipn
Пример #15
0
 def test_invalid(self, post):
     ipn = IPN('')
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Пример #16
0
 def test_still_ignored(self, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     ipn = IPN(urllib.urlencode(samples.sample_refund))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Пример #17
0
 def test_invalid(self, post):
     ipn = IPN('')
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Пример #18
0
 def test_still_ignored(self, post):
     post.return_value.text = 'VERIFIED'
     post.return_value.status_code = 200
     ipn = IPN(urllib.urlencode(samples.sample_refund))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Пример #19
0
 def test_purchase_not(self, completed, post):
     post.return_value.text = 'VERIFIED'
     completed.return_value = False
     ipn = IPN(urllib.urlencode(samples.sample_purchase))
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)