MCPcopy Index your code
hub / github.com/apache/cloudstack-go / TestCertificateService

Function TestCertificateService

test/CertificateService_test.go:28–161  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func 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

Callers

nothing calls this directly

Calls 15

NewClientFunction · 0.92
readDataFunction · 0.85
CreateTestServerFunction · 0.85
IssueCertificateMethod · 0.65
ListCAProvidersMethod · 0.65
ListCaCertificateMethod · 0.65

Tested by

no test coverage detected