Exemplo n.º 1
0
def test_check_version_success(mock_get, mock_cosmos):
    """
    Test _check_3dt_version(), 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
    main._check_3dt_version()
Exemplo n.º 2
0
def test_check_version_success(mock_get, mock_cosmos):
    """
    Test _check_3dt_version(), 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
    main._check_3dt_version()
Exemplo n.º 3
0
def test_check_version_fail(mock_cosmos):
    """
    Test _check_3dt_version(), should throw DCOSException exception.
    """

    mock_cosmos().enabled.return_value = True
    mock_cosmos().has_capability.return_value = False

    with pytest.raises(DCOSException) as excinfo:
        main._check_3dt_version()
    assert str(excinfo.value) == (
        'DC/OS backend does not support snapshot capabilities in this version.'
        ' Must be DC/OS >= 1.8')
Exemplo n.º 4
0
def test_check_version_fail(mock_cosmos):
    """
    Test _check_3dt_version(), should throw DCOSException exception.
    """

    mock_cosmos().enabled.return_value = True
    mock_cosmos().has_capability.return_value = False

    with pytest.raises(DCOSException) as excinfo:
        main._check_3dt_version()
    assert str(excinfo.value) == (
        'DC/OS backend does not support diagnostics capabilities in this '
        'version. Must be DC/OS >= 1.8')