Esempio n. 1
0
 def test_no_error_type(self):
     self.solitude.generic.transaction.get_object_or_404.side_effect = (
         ObjectDoesNotExist)
     tasks.pay_error_handler(**self.data(error_type=ZeroDivisionError))
     self.solitude.generic.transaction.post.assert_called_with({
         'status_reason': 'UNEXPECTED_ERROR',
         'provider': constants.PROVIDER_BANGO,
         'source': 'marketplace',
         'uuid': 'some:uid',
         'status': 7,
     })
Esempio n. 2
0
 def test_no_transaction(self):
     self.solitude.generic.transaction.get_object_or_404.side_effect = (
         ObjectDoesNotExist)
     tasks.pay_error_handler(**self.data())
     self.solitude.generic.transaction.post.assert_called_with({
         'status_reason': 'NO_PUBLICID_IN_JWT',
         'provider': constants.PROVIDER_BANGO,
         'source': 'marketplace',
         'uuid': 'some:uid',
         'status': 7,
     })
Esempio n. 3
0
    def test_transaction(self):
        self.solitude.generic.transaction.get_object_or_404.return_value = {
            'resource_pk': 1,
            'transaction_uuid': 'some:uid'
        }
        transaction = mock.Mock()
        self.solitude.generic.transaction.return_value = transaction

        tasks.pay_error_handler(**self.data())
        transaction.patch.assert_called_with({
            'status_reason': 'NO_PUBLICID_IN_JWT',
            'status': 7,
        })
Esempio n. 4
0
    def test_transaction(self):
        self.solitude.generic.transaction.get_object_or_404.return_value = {
            'resource_pk': 1,
            'transaction_uuid': 'some:uid'
        }
        transaction = mock.Mock()
        self.solitude.generic.transaction.return_value = transaction

        tasks.pay_error_handler(**self.data())
        transaction.patch.assert_called_with({
            'status_reason': 'NO_PUBLICID_IN_JWT',
            'status': 7,
        })