def test_main_invalid_topdir(mock_cli_parse, mock_time, mock_isdir, mock_exit, cli_args): mock_cli_parse.return_value = cli_args exc = '{} is not a directory'.format(cli_args.topdir) with pytest.raises(SystemExit): cumulus_bootstrap.main() mock_exit.assert_called_with({'ok': False, 'error_type': 'args', 'message': exc})
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): cumulus_bootstrap.main() mock_exit.assert_called_with({'ok': True}, dev=device) mock_wait.assert_called_with(countdown=cli_args.reload_delay, poll_delay=10, msg='Waiting for device access') if device.facts['virtual']: assert not mock_ensure_os.called else: mock_ensure_os.assert_called_with(device)