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()
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')
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')