예제 #1
0
파일: test_k8s_info.py 프로젝트: zhcf/nauta
def test_delete_namespace_failure(mocker, mocked_k8s_CoreV1Api,
                                  mocked_kubeconfig):
    mocked_k8s_CoreV1Api.delete_namespace.return_value = V1Status(
        status="{'phase': 'Other'}")

    with pytest.raises(KubernetesError):
        delete_namespace(test_namespace)
예제 #2
0
파일: helm.py 프로젝트: yuanbw/nauta
def delete_user(username: str):
    """
    Removes a user with all his/her objects

    :param username: name of a user to be deleted
    Throws an excpetion in case of any errors
    """
    with spinner(text=TextsDel.DELETION_DELETING_NAMESPACE):
        delete_namespace(username)

    with spinner(text=TextsDel.DELETION_DELETING_USERS_OBJECTS):
        delete_helm_release(username, purge=True)
예제 #3
0
파일: test_k8s_info.py 프로젝트: zhcf/nauta
def test_delete_namespace_exception(mocker, mocked_k8s_CoreV1Api,
                                    mocked_kubeconfig):
    mocked_k8s_CoreV1Api.delete_namespace.side_effect = RuntimeError()

    with pytest.raises(KubernetesError):
        delete_namespace(test_namespace)
예제 #4
0
파일: test_k8s_info.py 프로젝트: zhcf/nauta
def test_delete_namespace(mocker, mocked_k8s_CoreV1Api, mocked_kubeconfig):
    delete_namespace(test_namespace)

    assert mocked_k8s_CoreV1Api.delete_namespace.call_count == 1