MCPcopy Create free account
hub / github.com/clouditor/clouditor / TestGetCertificationTargetCommand

Function TestGetCertificationTargetCommand

cli/commands/cloud/cloud_test.go:120–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestGetCertificationTargetCommand(t *testing.T) {
121 var (
122 response orchestrator.CertificationTarget
123 target *orchestrator.CertificationTarget
124 svc *service_orchestrator.Service
125
126 err error
127 b bytes.Buffer
128 )
129
130 svc = service_orchestrator.NewService()
131 _, err = clitest.RunCLITestFunc(func() bool {
132 target, err = svc.CreateDefaultCertificationTarget()
133
134 fmt.Println("target:", target)
135 // target should be non-nil since it has been newly created
136 assert.NotNil(t, target)
137 assert.NoError(t, err)
138
139 cli.Output = &b
140
141 cmd := NewGetCertificationTargetCommand()
142 err = cmd.RunE(nil, []string{target.Id})
143
144 assert.NoError(t, err)
145
146 err = protojson.Unmarshal(b.Bytes(), &response)
147
148 assert.NoError(t, err)
149 return assert.Equal(t, target.Id, response.Id)
150 }, server.WithServices(svc))
151 assert.NoError(t, err)
152}
153
154func TestRemoveCertificationTargetsCommand(t *testing.T) {
155 var (

Callers

nothing calls this directly

Calls 7

RunCLITestFuncFunction · 0.92
NotNilFunction · 0.92
EqualFunction · 0.92
WithServicesFunction · 0.92
NewServiceMethod · 0.65

Tested by

no test coverage detected