Esempio n. 1
0
def test_main_no_topdir(mock_cli_parse, mock_is_dir, mock_exit, cli_args):
    mock_cli_parse.return_value = cli_args
    exc = '{} is not a directory'.format(cli_args.topdir)
    with pytest.raises(SystemExit):
        eos_bootstrap.main()
    mock_exit.assert_called_with({'ok': False,
                                  'error_type': 'args',
                                  'message': exc})
Esempio n. 2
0
def test_main(mock_cli_parse, mock_time, mock_isdir, mock_exit, mock_wait, mock_ensure_os, cli_args, device):
    mock_cli_parse.return_value = cli_args
    mock_wait.return_value = device
    with pytest.raises(SystemExit):
        eos_bootstrap.main()
    mock_exit.assert_called_with({'ok': True},
                                 dev=device)
    mock_wait.assert_called_with(countdown=cli_args.reload_delay, poll_delay=10)
    if device.facts['virtual']:
        assert not mock_ensure_os.called
    else:
        mock_ensure_os.assert_called_with(device)