"""Functional tests for creating a TransferWise Recipient.""" from unittest.mock import MagicMock, patch from tests.testutils import db, mock_auth from tests.testutils import transferwise_fixtures as fixtures @patch("collaborator.models.transferwise.requests") @db.test_schema_default_seed def test_cancel_batch_payment(mock_transferwise, auth_client, mocker, mock_account): """Test cancel batch payment.""" mock_auth(mocker, mock_account.id) mock_response = MagicMock() mock_response.status_code = 200 mock_response.json.return_value = fixtures.BATCH_CANCELLED_RESPONSE mock_transferwise.get.return_value = mock_response mock_transferwise.post.return_value = mock_response mock_transferwise.patch.return_value = mock_response data = {"vendor_id": mock_account.id} result = auth_client.put("/transferwise/batch/1/cancel", json=data) assert result.json["status"] == "CANCELLED" assert result.status_code == 200 @db.test_schema_default_seed def test_cancel_batch_payment_error(auth_client, mocker): """Test cancel batch payment error.""" mock_auth(mocker, 123) result = auth_client.put("/transferwise/batch/6/cancel", json={}) assert result.status_code == 404