aboutsummaryrefslogtreecommitdiffstats
path: root/tests/aaf/certservice/libraries
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2020-03-05 16:43:50 +0100
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2020-03-10 13:04:29 +0100
commit75573b0409eeabbd08f3a2801fd11c47078a249f (patch)
tree47a6f52a7eb3f3a57677dcd082fd6c03a210c8c7 /tests/aaf/certservice/libraries
parentb133879ebd28e6e8c6cbb65534ac361f2a7550a8 (diff)
Add CSIT for Cert Service Client
Issue-ID: AAF-996 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: If29633f8ce382c4bef2c14ff7ec9b5377c866d4a
Diffstat (limited to 'tests/aaf/certservice/libraries')
-rw-r--r--tests/aaf/certservice/libraries/CertClientManager.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/aaf/certservice/libraries/CertClientManager.py b/tests/aaf/certservice/libraries/CertClientManager.py
new file mode 100644
index 00000000..30501c8b
--- /dev/null
+++ b/tests/aaf/certservice/libraries/CertClientManager.py
@@ -0,0 +1,27 @@
+import docker
+
+
+class CertClientManager:
+
+ def run_client_container(self, client_image, container_name, path_to_env, request_url, network):
+ client = docker.from_env()
+ environment = self.read_list_env_from_file(path_to_env)
+ environment.append("REQUEST_URL=" + request_url)
+ container = client.containers.run(image=client_image, name=container_name, detach=True, environment=environment,
+ network=network)
+ exitcode = container.wait()
+ return exitcode
+
+ def remove_client_container(self, container_name):
+ client = docker.from_env()
+ container = client.containers.get(container_name)
+ container.remove()
+
+ def read_list_env_from_file(self, path):
+ f = open(path, "r")
+ r_list = []
+ for line in f:
+ line = line.strip()
+ if line[0] != "#":
+ r_list.append(line)
+ return r_list