예제 #1
0
def test_node_diagnostics_list(mock_do_diagnostics_request, mock_get,
                               mock_cosmos):
    """
    Test _bundle_manage(), should not fail
    """

    mock_cosmos().enabled.return_value = True
    m = mock.MagicMock()
    m.json.return_value = {
        'capabilities': [{'name': 'SUPPORT_CLUSTER_REPORT'}]
    }
    mock_get.return_value = m
    mock_do_diagnostics_request.return_value = {
        '127.0.0.1': [
            {
                'file_name': 'bundle.zip',
                'file_size': 123
            }
        ]
    }

    # _bundle_manage(list_bundles, status, cancel, json)
    main._bundle_manage(True, False, False, False)
    mock_do_diagnostics_request.assert_called_once_with(
        '/system/health/v1/report/diagnostics/list/all',
        'GET'
    )
예제 #2
0
def test_node_diagnostics_list(mock_do_diagnostics_request, mock_get,
                               mock_cosmos):
    """
    Test _bundle_manage(), should not fail
    """

    mock_cosmos().enabled.return_value = True
    m = mock.MagicMock()
    m.json.return_value = {
        'capabilities': [{'name': 'SUPPORT_CLUSTER_REPORT'}]
    }
    mock_get.return_value = m
    mock_do_diagnostics_request.return_value = {
        '127.0.0.1': [
            {
                'file_name': 'bundle.zip',
                'file_size': 123
            }
        ]
    }

    # _bundle_manage(list_bundles, status, cancel, json)
    main._bundle_manage(True, False, False, False)
    mock_do_diagnostics_request.assert_called_once_with(
        '/system/health/v1/report/diagnostics/list/all',
        'GET'
    )
예제 #3
0
def test_node_diagnostics_cancel(mock_do_diagnostics_request, mock_get,
                                 mock_cosmos):
    """
    Test _bundle_manage(), should not fail
    """

    mock_cosmos().enabled.return_value = True
    m = mock.MagicMock()
    m.json.return_value = {
        'capabilities': [{
            'name': 'SUPPORT_CLUSTER_REPORT'
        }]
    }
    mock_get.return_value = m
    mock_do_diagnostics_request.return_value = {'status': 'success'}

    # _bundle_manage(list_bundles, status, cancel, json)
    main._bundle_manage(False, False, True, False)
    mock_do_diagnostics_request.assert_called_once_with(
        '/system/health/v1/report/diagnostics/cancel', 'POST')
예제 #4
0
def test_node_diagnostics_cancel(mock_do_diagnostics_request, mock_get,
                                 mock_cosmos):
    """
    Test _bundle_manage(), should not fail
    """

    mock_cosmos().enabled.return_value = True
    m = mock.MagicMock()
    m.json.return_value = {
        'capabilities': [{'name': 'SUPPORT_CLUSTER_REPORT'}]
    }
    mock_get.return_value = m
    mock_do_diagnostics_request.return_value = {
        'status': 'success'
    }

    # _bundle_manage(list_bundles, status, cancel, json)
    main._bundle_manage(False, False, True, False)
    mock_do_diagnostics_request.assert_called_once_with(
        '/system/health/v1/report/diagnostics/cancel',
        'POST'
    )