Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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
Example #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
Example #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)
Example #10
0
 def create(self, data):
     ipn = IPN(data)
     mock = Mock()
     mock.return_value = True
     ipn.is_valid = mock
     return ipn
Example #11
0
 def test_not_completed(self, post):
     eq_(IPN('status=something').is_valid(), False)
Example #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)
Example #13
0
 def test_empty(self, post):
     eq_(IPN('').is_valid(), False)
Example #14
0
 def create(self, data):
     ipn = IPN(data)
     mock = Mock()
     mock.return_value = True
     ipn.is_valid = mock
     return ipn
Example #15
0
 def test_invalid(self, post):
     ipn = IPN('')
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Example #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)
Example #17
0
 def test_invalid(self, post):
     ipn = IPN('')
     ipn.process()
     eq_(ipn.status, constants.IPN_STATUS_IGNORED)
Example #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)
Example #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)