(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestCertificateService(t *testing.T) { |
| 29 | service := "CertificateService" |
| 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 | testissueCertificate := func(t *testing.T) { |
| 39 | if _, ok := response["issueCertificate"]; !ok { |
| 40 | t.Skipf("Skipping as no json response is provided in testdata") |
| 41 | } |
| 42 | p := client.Certificate.NewIssueCertificateParams() |
| 43 | _, err := client.Certificate.IssueCertificate(p) |
| 44 | if err != nil { |
| 45 | t.Errorf(err.Error()) |
| 46 | } |
| 47 | } |
| 48 | t.Run("IssueCertificate", testissueCertificate) |
| 49 | |
| 50 | testlistCAProviders := func(t *testing.T) { |
| 51 | if _, ok := response["listCAProviders"]; !ok { |
| 52 | t.Skipf("Skipping as no json response is provided in testdata") |
| 53 | } |
| 54 | p := client.Certificate.NewListCAProvidersParams() |
| 55 | _, err := client.Certificate.ListCAProviders(p) |
| 56 | if err != nil { |
| 57 | t.Errorf(err.Error()) |
| 58 | } |
| 59 | } |
| 60 | t.Run("ListCAProviders", testlistCAProviders) |
| 61 | |
| 62 | testlistCaCertificate := func(t *testing.T) { |
| 63 | if _, ok := response["listCaCertificate"]; !ok { |
| 64 | t.Skipf("Skipping as no json response is provided in testdata") |
| 65 | } |
| 66 | p := client.Certificate.NewListCaCertificateParams() |
| 67 | _, err := client.Certificate.ListCaCertificate(p) |
| 68 | if err != nil { |
| 69 | t.Errorf(err.Error()) |
| 70 | } |
| 71 | } |
| 72 | t.Run("ListCaCertificate", testlistCaCertificate) |
| 73 | |
| 74 | testlistTemplateDirectDownloadCertificates := func(t *testing.T) { |
| 75 | if _, ok := response["listTemplateDirectDownloadCertificates"]; !ok { |
| 76 | t.Skipf("Skipping as no json response is provided in testdata") |
| 77 | } |
| 78 | p := client.Certificate.NewListTemplateDirectDownloadCertificatesParams() |
| 79 | _, err := client.Certificate.ListTemplateDirectDownloadCertificates(p) |
| 80 | if err != nil { |
| 81 | t.Errorf(err.Error()) |
| 82 | } |
| 83 | } |
| 84 | t.Run("ListTemplateDirectDownloadCertificates", testlistTemplateDirectDownloadCertificates) |
| 85 |
nothing calls this directly
no test coverage detected