@@ -60,14 +60,12 @@ async def test_pod_apis(self):
6060 }
6161 }
6262
63- resp = await api .create_namespaced_pod (body = pod_manifest ,
64- namespace = 'default' )
63+ resp = await api .create_namespaced_pod (body = pod_manifest , namespace = 'default' )
6564 self .assertEqual (name , resp .metadata .name )
6665 self .assertTrue (resp .status .phase )
6766
6867 while True :
69- resp = await api .read_namespaced_pod (name = name ,
70- namespace = 'default' )
68+ resp = await api .read_namespaced_pod (name = name , namespace = 'default' )
7169 self .assertEqual (name , resp .metadata .name )
7270 self .assertTrue (resp .status .phase )
7371 if resp .status .phase != 'Pending' :
@@ -77,27 +75,26 @@ async def test_pod_apis(self):
7775 exec_command = ['/bin/sh' ,
7876 '-c' ,
7977 'for i in $(seq 1 3); do date; done' ]
80- resp = await api_ws .connect_get_namespaced_pod_exec (name , 'default' ,
81- command = exec_command ,
82- stderr = False , stdin = False ,
83- stdout = True , tty = False )
78+ resp = await api_ws .connect_get_namespaced_pod_exec (
79+ name , 'default' , command = exec_command ,
80+ stderr = False , stdin = False , stdout = True , tty = False
81+ )
8482 print ('EXEC response : %s' % resp )
8583 self .assertEqual (3 , len (resp .splitlines ()))
8684
8785 exec_command = 'uptime'
88- resp = await api_ws .connect_post_namespaced_pod_exec (name , 'default' ,
89- command = exec_command ,
90- stderr = False , stdin = False ,
91- stdout = True , tty = False )
86+ resp = await api_ws .connect_post_namespaced_pod_exec (
87+ name , 'default' , command = exec_command ,
88+ stderr = False , stdin = False , stdout = True , tty = False
89+ )
9290 print ('EXEC response : %s' % resp )
9391 self .assertEqual (1 , len (resp .splitlines ()))
9492
9593 resp = await api .list_pod_for_all_namespaces ()
9694 number_of_pods = len (resp .items )
9795 self .assertTrue (number_of_pods > 0 )
9896
99- resp = await api .delete_namespaced_pod (name = name , body = {},
100- namespace = 'default' )
97+ resp = await api .delete_namespaced_pod (name = name , body = {}, namespace = 'default' )
10198
10299 async def test_service_apis (self ):
103100 client = api_client .ApiClient (configuration = self .config )
@@ -115,28 +112,29 @@ async def test_service_apis(self):
115112 'targetPort' : 80 }],
116113 'selector' : {'name' : name }}}
117114
118- resp = await api .create_namespaced_service (body = service_manifest ,
119- namespace = 'default' )
115+ resp = await api .create_namespaced_service (body = service_manifest , namespace = 'default' )
120116 self .assertEqual (name , resp .metadata .name )
121117 self .assertTrue (resp .status )
122118
123- resp = await api .read_namespaced_service (name = name ,
124- namespace = 'default' )
119+ resp = await api .read_namespaced_service (name = name , namespace = 'default' )
125120 self .assertEqual (name , resp .metadata .name )
126121 self .assertTrue (resp .status )
127122
128- service_manifest ['spec' ]['ports' ] = [{'name' : 'new' ,
129- 'port' : 8080 ,
130- 'protocol' : 'TCP' ,
131- 'targetPort' : 8080 }]
132- resp = await api .patch_namespaced_service (body = service_manifest ,
133- name = name ,
134- namespace = 'default' )
123+ service_manifest ['spec' ]['ports' ] = [
124+ {'name' : 'new' ,
125+ 'port' : 8080 ,
126+ 'protocol' : 'TCP' ,
127+ 'targetPort' : 8080 }
128+ ]
129+ resp = await api .patch_namespaced_service (
130+ body = service_manifest ,
131+ name = name ,
132+ namespace = 'default'
133+ )
135134 self .assertEqual (2 , len (resp .spec .ports ))
136135 self .assertTrue (resp .status )
137136
138- resp = await api .delete_namespaced_service (name = name , body = {},
139- namespace = 'default' )
137+ resp = await api .delete_namespaced_service (name = name , body = {}, namespace = 'default' )
140138
141139 async def test_replication_controller_apis (self ):
142140 client = api_client .ApiClient (configuration = self .config )
@@ -146,17 +144,29 @@ async def test_replication_controller_apis(self):
146144 rc_manifest = {
147145 'apiVersion' : 'v1' ,
148146 'kind' : 'ReplicationController' ,
149- 'metadata' : {'labels' : {'name' : name },
150- 'name' : name },
151- 'spec' : {'replicas' : 2 ,
152- 'selector' : {'name' : name },
153- 'template' : {'metadata' : {
154- 'labels' : {'name' : name }},
155- 'spec' : {'containers' : [{
156- 'image' : 'nginx' ,
157- 'name' : 'nginx' ,
158- 'ports' : [{'containerPort' : 80 ,
159- 'protocol' : 'TCP' }]}]}}}}
147+ 'metadata' : {
148+ 'labels' : {'name' : name },
149+ 'name' : name
150+ },
151+ 'spec' : {
152+ 'replicas' : 2 ,
153+ 'selector' : {
154+ 'name' : name
155+ },
156+ 'template' : {
157+ 'metadata' : {'labels' : {'name' : name }},
158+ 'spec' : {
159+ 'containers' : [
160+ {
161+ 'image' : 'nginx' ,
162+ 'name' : 'nginx' ,
163+ 'ports' : [{'containerPort' : 80 , 'protocol' : 'TCP' }]
164+ }
165+ ]
166+ }
167+ }
168+ }
169+ }
160170
161171 resp = await api .create_namespaced_replication_controller (
162172 body = rc_manifest , namespace = 'default' )
0 commit comments