@@ -264,26 +264,17 @@ def allocate(method, path, *, json):
264264 assert pod ["machineId" ] == "at-boundary"
265265
266266
267- def test_create_cpu_pod_translates_instance_id ():
268- with patch (
269- "runpod.api.ctl_commands.run_rest_request" , return_value = {"id" : "pod" }
270- ) as request :
271- ctl_commands .create_pod ("cpu-pod" , "python:3.11" , instance_id = "cpu3c-4-8" )
272-
273- assert request .call_args .kwargs ["json" ]["cpu" ] == {
274- "id" : "cpu3c" ,
275- "vcpuCount" : 4 ,
276- }
277-
278-
279267def test_create_cpu_pod_requires_instance_id ():
280268 with pytest .raises (ValueError , match = "instance_id" ):
281269 ctl_commands .create_pod ("cpu-pod" , "python:3.11" )
282270
283271
284- def test_create_cpu_pod_validates_instance_id ():
272+ @pytest .mark .parametrize (
273+ "instance_id" , ["cpu3c-invalid" , "cpu3c" , "cpu3c-4-not-a-number" ]
274+ )
275+ def test_create_cpu_pod_validates_instance_id (template_backend , instance_id ):
285276 with pytest .raises (ValueError , match = "format" ):
286- ctl_commands .create_pod ("cpu-pod" , "python:3.11" , instance_id = "cpu3c-invalid" )
277+ ctl_commands .create_pod ("cpu-pod" , "python:3.11" , instance_id = instance_id )
287278
288279
289280def test_create_pod_validates_image_and_cloud ():
@@ -310,19 +301,12 @@ def test_create_gpu_pod_rejects_unsupported_constraints(template_backend, kwargs
310301 ctl_commands .create_pod ("pod" , "image" , gpu_type_id = "NVIDIA A100" , ** kwargs )
311302
312303
313- def test_stop_and_resume_pod_use_actions ():
314- with patch (
315- "runpod.api.ctl_commands.run_rest_request" , return_value = {"id" : "pod" }
316- ) as request :
317- assert ctl_commands .stop_pod ("pod" ) == {"id" : "pod" }
318- assert ctl_commands .resume_pod ("pod" , 8 ) == {"id" : "pod" }
319-
320- assert request .call_args_list [0 ].args == (
321- "POST" ,
322- "/v2/pods/pod/action" ,
323- )
324- assert request .call_args_list [0 ].kwargs == {"json" : {"action" : "stop" }}
325- assert request .call_args_list [1 ].kwargs == {"json" : {"action" : "start" }}
304+ def test_resume_pod_rejects_gpu_count ():
305+ with (
306+ patch ("runpod.api.ctl_commands.run_rest_request" , return_value = {"id" : "pod" }),
307+ pytest .raises (ValueError , match = "gpu_count" ),
308+ ):
309+ ctl_commands .resume_pod ("pod" , 8 )
326310
327311
328312def test_terminate_pod_deletes_resource ():
@@ -461,21 +445,6 @@ def test_create_container_registry_auth_uses_rest():
461445 )
462446
463447
464- def test_update_container_registry_auth_uses_graphql ():
465- with patch (
466- "runpod.api.ctl_commands.run_graphql_query" ,
467- return_value = {"data" : {"updateRegistryAuth" : {"id" : "registry" }}},
468- ) as request :
469- result = ctl_commands .update_container_registry_auth (
470- "registry" , "user" , "password"
471- )
472-
473- assert result == {"id" : "registry" }
474- mutation = request .call_args .args [0 ]
475- assert "mutation UpdateRegistryAuth" in mutation
476- assert 'id: "registry"' in mutation
477-
478-
479448def test_delete_container_registry_auth_uses_rest ():
480449 with patch (
481450 "runpod.api.ctl_commands.run_rest_request" , return_value = None
0 commit comments