(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestISOService(t *testing.T) { |
| 29 | service := "ISOService" |
| 30 | response, err := readData(service) |
| 31 | if err != nil { |
| 32 | t.Skipf("Skipping test as %v", err) |
| 33 | } |
| 34 | server := CreateTestServer(t, response) |
| 35 | client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true) |
| 36 | defer server.Close() |
| 37 | |
| 38 | testattachIso := func(t *testing.T) { |
| 39 | if _, ok := response["attachIso"]; !ok { |
| 40 | t.Skipf("Skipping as no json response is provided in testdata") |
| 41 | } |
| 42 | p := client.ISO.NewAttachIsoParams("id", "virtualmachineid") |
| 43 | r, err := client.ISO.AttachIso(p) |
| 44 | if err != nil { |
| 45 | t.Errorf(err.Error()) |
| 46 | } |
| 47 | if r.Id == "" { |
| 48 | t.Errorf("Failed to parse response. ID not found") |
| 49 | } |
| 50 | } |
| 51 | t.Run("AttachIso", testattachIso) |
| 52 | |
| 53 | testcopyIso := func(t *testing.T) { |
| 54 | if _, ok := response["copyIso"]; !ok { |
| 55 | t.Skipf("Skipping as no json response is provided in testdata") |
| 56 | } |
| 57 | p := client.ISO.NewCopyIsoParams("id") |
| 58 | r, err := client.ISO.CopyIso(p) |
| 59 | if err != nil { |
| 60 | t.Errorf(err.Error()) |
| 61 | } |
| 62 | if r.Id == "" { |
| 63 | t.Errorf("Failed to parse response. ID not found") |
| 64 | } |
| 65 | } |
| 66 | t.Run("CopyIso", testcopyIso) |
| 67 | |
| 68 | testdeleteIso := func(t *testing.T) { |
| 69 | if _, ok := response["deleteIso"]; !ok { |
| 70 | t.Skipf("Skipping as no json response is provided in testdata") |
| 71 | } |
| 72 | p := client.ISO.NewDeleteIsoParams("id") |
| 73 | _, err := client.ISO.DeleteIso(p) |
| 74 | if err != nil { |
| 75 | t.Errorf(err.Error()) |
| 76 | } |
| 77 | } |
| 78 | t.Run("DeleteIso", testdeleteIso) |
| 79 | |
| 80 | testdetachIso := func(t *testing.T) { |
| 81 | if _, ok := response["detachIso"]; !ok { |
| 82 | t.Skipf("Skipping as no json response is provided in testdata") |
| 83 | } |
| 84 | p := client.ISO.NewDetachIsoParams("virtualmachineid") |
| 85 | r, err := client.ISO.DetachIso(p) |
nothing calls this directly
no test coverage detected