def test_pay_preapproval_no_retry(self, post_pay): post_pay.side_effect = client.Error('nope', code='539012') with self.assertRaises(client.Error): client.pay(self.data, retry=False) eq_(post_pay.call_count, 1) args = post_pay.call_args_list[0][1] eq_(args['data']['use_preapproval'], True)
def test_pay_preapproval(self, post_pay): post_pay.side_effect = client.Error('nope', code='539012') with self.assertRaises(client.Error): data = self.data data['buyer'] = self.user client.pay(data) eq_(post_pay.call_count, 2) args = post_pay.call_args_list[1][1] eq_(args['data']['use_preapproval'], False)
def test_pay_not_preapproval(self, post_pay): post_pay.side_effect = client.Error('nope', code='0') with self.assertRaises(client.Error): client.pay(self.data) # It did not retry because this is not a pre-approval error. eq_(post_pay.call_count, 1)