@patch('paasta_tools.cli.utils.validate_service_name', autospec=True)
@patch('sys.stdout', new_callable=StringIO)
def test_figure_out_service_name_not_found(mock_stdout,
                                           mock_validate_service_name):
    # paasta_status with invalid -s service_name arg results in error
    mock_validate_service_name.side_effect = NoSuchService(None)
    parsed_args = Mock()
    parsed_args.service = 'fake_service'

    expected_output = NoSuchService.GUESS_ERROR_MSG % '%s\n'

    # Fail if exit(1) does not get called
    with raises(SystemExit) as sys_exit:
        status.figure_out_service_name(parsed_args)

    output = mock_stdout.getvalue()
    assert sys_exit.value.code == 1
    assert output == expected_output
dataset/ETHPy150Open Yelp/paasta/tests/cli/test_cmds_status.py/test_figure_out_service_name_not_found/swapped operands of `%`