added stop container

This commit is contained in:
2022-10-18 14:14:53 -05:00
parent f4e7273735
commit 808dc294b9
5 changed files with 31 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import unittest
import requests
from json import load
from cclient import c_auth, c_get_containers, c_start_container
from cclient import c_auth, c_get_containers, c_start_container, c_stop_container
from cprocess import build_cont_list
class TestCrane(unittest.TestCase):
@@ -13,8 +13,9 @@ class TestCrane(unittest.TestCase):
self.username = self.config["username"]
self.password = self.config["password"]
self.endpoint = self.config["endpoint"]
self.cid = 'ef8fee86e02b2b82acbddf6f0da1ff023f60bfe52c0b4087cac29c1686ccbac4'
self.cid = '06ffaed8153495db19b35f5982e0f9d4cfea0da7b803f825a6686a4017af8d6e'
self.req_obj = requests
self.hypercare_containers = ['hello-world']
def test_c_auth(self):
self.jwt = c_auth(self.req_obj, self.host, self.port, self.username, self.password)
self.assertTrue(self.jwt, "No JWT returned by cauth.")
@@ -27,7 +28,7 @@ class TestCrane(unittest.TestCase):
def test_build_cont_list(self):
self.jwt = c_auth(self.req_obj, self.host, self.port, self.username, self.password)
self.cont_obj = c_get_containers(self.req_obj, self.host, self.port, self.jwt, self.endpoint)
self.cont_list = build_cont_list(self.cont_obj)
self.cont_list = build_cont_list(self.cont_obj, self.hypercare_containers)
self.assertTrue(self.cont_list, "No cont_list returned by build_cont_list.")
def test_c_start_container(self):
@@ -36,6 +37,11 @@ class TestCrane(unittest.TestCase):
print(self.c_start_container_response)
self.assertTrue(self.c_start_container_response, "No c_start_container_resonse returned by c_start_container.")
# 204 success 304 already on
def test_c_stop_container(self):
self.jwt = c_auth(self.req_obj, self.host, self.port, self.username, self.password)
self.c_stop_container_response = c_stop_container(self.req_obj, self.host, self.port, self.jwt, self.endpoint, self.cid)
print(self.c_stop_container_response)
self.assertTrue(self.c_stop_container_response, "No c_start_container_resonse returned by c_start_container.")
if __name__ == '__main__':
unittest.main()