def METHOD_NAME():
    rule = {'command': ['/bin/test/', '--arg', '%(somefield)s'],
            'pipe_alert_text': True, 'type': mock_rule(), 'name': 'Test'}
    alert = CommandAlerter(rule)
    match = {'@timestamp': '2014-01-01T00:00:00',
             'somefield': 'foobarbaz'}
    alert_text = str(BasicMatchString(rule, match))
    with mock.patch("elastalert.alerters.command.subprocess.Popen") as mock_popen:
        mock_subprocess = mock.Mock()
        mock_popen.return_value = mock_subprocess
        mock_subprocess.communicate.return_value = (None, None)
        alert.alert([match])
    assert mock_popen.called_with(['/bin/test', '--arg', 'foobarbaz'], stdin=subprocess.PIPE, shell=False)
    assert mock_subprocess.communicate.called_with(input=alert_text.encode())