File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed
Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ def cluster_create(
131131
132132 result = self .client .post (
133133 "/lke/clusters" ,
134- data = _flatten_request_body_recursive ( drop_null_keys (params )),
134+ data = drop_null_keys ( _flatten_request_body_recursive (params )),
135135 )
136136
137137 if "id" not in result :
Original file line number Diff line number Diff line change @@ -298,6 +298,20 @@ def test_lke_cluster_acl(lke_cluster_with_acl):
298298 assert acl .addresses .ipv4 == ["10.0.0.2/32" ]
299299
300300
301+ def test_lke_cluster_update_acl_null_addresses (lke_cluster_with_acl ):
302+ cluster = lke_cluster_with_acl
303+
304+ # Addresses should not be included in the request if it's null,
305+ # else an error will be returned by the API.
306+ # See: TPT-3489
307+ acl = cluster .control_plane_acl_update (
308+ {"enabled" : False , "addresses" : None }
309+ )
310+
311+ assert acl == cluster .control_plane_acl
312+ assert acl .addresses .ipv4 == ["10.0.0.1/32" ]
313+
314+
301315def test_lke_cluster_disable_acl (lke_cluster_with_acl ):
302316 cluster = lke_cluster_with_acl
303317
Original file line number Diff line number Diff line change @@ -504,10 +504,10 @@ def test_cluster_update_null_addresses(self):
504504
505505 with self .mock_put ("lke/clusters/18881/control_plane_acl" ) as m :
506506 cluster .control_plane_acl_update (
507- LKEClusterControlPlaneACLOptions (
508- enabled = True ,
509- addresses = None ,
510- )
507+ {
508+ " enabled" : True ,
509+ " addresses" : None ,
510+ }
511511 )
512512
513513 # Addresses should not be included in the API request if it's null
You can’t perform that action at this time.
0 commit comments