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)
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)
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)
def test_delete_namespace(mocker, mocked_k8s_CoreV1Api, mocked_kubeconfig): delete_namespace(test_namespace) assert mocked_k8s_CoreV1Api.delete_namespace.call_count == 1