def test_does_not_retry_when_validation_error_raised( mock_retry: MagicMock, mock_capture_exception: MagicMock) -> None: account_dict = dict( nombre='Ricardo', apellido_paterno='Sánchez', cuenta='646180157069665325', rfc_curp=None, telefono='5567980796', ) create_account(account_dict) mock_capture_exception.assert_called_once() mock_retry.assert_not_called()
def test_does_not_retry_when_invalid_rfc_raised( mock_retry: MagicMock, mock_capture_exception: MagicMock) -> None: account_dict = dict( nombre='24', apellido_paterno='napoli', apellido_materno='vico pergola sant antonio abate 24', cuenta='646180157069665325', rfc_curp='VIN2810417HNECPX01', telefono='5567980796', ) create_account(account_dict) mock_capture_exception.assert_called_once() mock_retry.assert_not_called()
def test_raises_unexpected_exception( mock_retry: MagicMock, mock_capture_exception: MagicMock) -> None: account_dict = dict( nombre='24', apellido_paterno='napoli', apellido_materno='vico pergola sant antonio abate 24', cuenta='646180157069665325', rfc_curp='VIN2810417HNECPX01', telefono='5567980796', ) with patch( 'speid.tasks.accounts.execute_create_account', side_effect=Exception('error!'), ): create_account(account_dict) mock_capture_exception.assert_called_once() mock_retry.assert_called_once()