summaryrefslogtreecommitdiffstats
path: root/k8s/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'k8s/tests/conftest.py')
-rw-r--r--k8s/tests/conftest.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/k8s/tests/conftest.py b/k8s/tests/conftest.py
index ae09da1..442e03c 100644
--- a/k8s/tests/conftest.py
+++ b/k8s/tests/conftest.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# ================================================================================
# Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Nokia. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -39,6 +40,7 @@ def mockk8sapi(monkeypatch):
# to get an API object
core = client.CoreV1Api()
ext = client.ExtensionsV1beta1Api()
+ appsv1 = client.AppsV1Api()
def pseudo_deploy(namespace, dep):
return dep
@@ -60,9 +62,17 @@ def mockk8sapi(monkeypatch):
monkeypatch.setattr(ext,"create_namespaced_deployment", pseudo_deploy)
return ext
+ # patched_appsv1 returns an AppsV1Api object with the
+ # create_namespaced_deployment method stubbed out so that there
+ # is no attempt to call the k8s API server
+ def patched_appsv1():
+ monkeypatch.setattr(ext,"create_namespaced_deployment", pseudo_deploy)
+ return ext
+
def pseudo_configure(loc):
pass
monkeypatch.setattr(k8sclient.k8sclient,"_configure_api", pseudo_configure)
monkeypatch.setattr(client, "CoreV1Api", patched_core)
monkeypatch.setattr(client,"ExtensionsV1beta1Api", patched_ext)
+ monkeypatch.setattr(client,"AppsV1Api", patched_appsv1)