@@ -260,6 +260,25 @@ func TestDeleteInstance(t *testing.T) {
260
260
EnsureSuccessfulSimpleResponse (t , got , err )
261
261
}
262
262
263
+ func TestDeleteInstanceVncSession (t * testing.T ) {
264
+ client , server , _ := NewAdvancedClientForTesting ([]ConfigAdvanceClientForTesting {
265
+ {
266
+ Method : "DELETE" ,
267
+ Value : []ValueAdvanceClientForTesting {
268
+ {
269
+ RequestBody : "" ,
270
+ URL : "/v2/instances/12345/vnc" ,
271
+ ResponseBody : `{"result": "ok"}` ,
272
+ },
273
+ },
274
+ },
275
+ })
276
+ defer server .Close ()
277
+
278
+ got , err := client .DeleteInstanceVncSession ("12345" )
279
+ EnsureSuccessfulSimpleResponse (t , got , err )
280
+ }
281
+
263
282
func TestRebootInstance (t * testing.T ) {
264
283
client , server , _ := NewAdvancedClientForTesting ([]ConfigAdvanceClientForTesting {
265
284
{
@@ -393,6 +412,36 @@ func TestMovePublicIPToInstance(t *testing.T) {
393
412
EnsureSuccessfulSimpleResponse (t , got , err )
394
413
}
395
414
415
+ func TestGetInstanceVncStatus (t * testing.T ) {
416
+ client , server , _ := NewAdvancedClientForTesting ([]ConfigAdvanceClientForTesting {
417
+ {
418
+ Method : "GET" ,
419
+ Value : []ValueAdvanceClientForTesting {
420
+ {
421
+ RequestBody : `""` ,
422
+ URL : "/v2/instances/12345/vnc" ,
423
+ ResponseBody : `{"uri": "https://vnc.example.com/12345", "expiration": "2025-06-02T12:00:00Z"}` ,
424
+ },
425
+ },
426
+ },
427
+ })
428
+ defer server .Close ()
429
+
430
+ got , err := client .GetInstanceVncStatus ("12345" )
431
+
432
+ if got .URI != "https://vnc.example.com/12345" {
433
+ t .Errorf ("Expected URI %s, got %s" , "https://vnc.example.com/12345" , got .URI )
434
+ }
435
+
436
+ if got .Expiration != "2025-06-02T12:00:00Z" {
437
+ t .Errorf ("Expected Expiration %s, got %s" , "2025-06-02T12:00:00Z" , got .Expiration )
438
+ }
439
+
440
+ if err != nil {
441
+ t .Errorf ("Request returned an error: %s" , err )
442
+ }
443
+ }
444
+
396
445
func TestGetInstanceConsoleURL (t * testing.T ) {
397
446
client , server , _ := NewAdvancedClientForTesting ([]ConfigAdvanceClientForTesting {
398
447
{
0 commit comments