@@ -171,7 +171,7 @@ func TestCertificateOps_CreateManagedCertificate(t *testing.T) {
171171 {
172172 Name : "certificate creation successful" ,
173173 Mock : func (_ * testing.T , tt * certificateOpsTestCase ) {
174- res := hcloud.CertificateCreateResult {Certificate : & hcloud.Certificate {ID : 1 }}
174+ res := hcloud.CertificateCreateResult {Certificate : & hcloud.Certificate {ID : 1 }, Action : & hcloud. Action { ID : 2 } }
175175 tt .CertClient .
176176 On ("CreateCertificate" , tt .Ctx , hcloud.CertificateCreateOpts {
177177 Name : "test-cert" ,
@@ -180,6 +180,7 @@ func TestCertificateOps_CreateManagedCertificate(t *testing.T) {
180180 Labels : map [string ]string {"key" : "value" },
181181 }).
182182 Return (res , nil , nil )
183+ tt .ActionClient .On ("WaitFor" , tt .Ctx , & hcloud.Action {ID : 2 }).Return (nil )
183184 },
184185 Perform : func (t * testing.T , tt * certificateOpsTestCase ) {
185186 err := tt .CertOps .CreateManagedCertificate (
@@ -204,9 +205,10 @@ type certificateOpsTestCase struct {
204205 ClientErr error
205206
206207 // Set in run before actual test execution
207- Ctx context.Context
208- CertOps * hcops.CertificateOps
209- CertClient * mocks.CertificateClient
208+ Ctx context.Context
209+ CertOps * hcops.CertificateOps
210+ CertClient * mocks.CertificateClient
211+ ActionClient * mocks.ActionClient
210212}
211213
212214func (tt * certificateOpsTestCase ) run (t * testing.T ) {
@@ -215,7 +217,9 @@ func (tt *certificateOpsTestCase) run(t *testing.T) {
215217 tt .Ctx = context .Background ()
216218 tt .CertClient = & mocks.CertificateClient {}
217219 tt .CertClient .Test (t )
218- tt .CertOps = & hcops.CertificateOps {CertClient : tt .CertClient }
220+ tt .ActionClient = & mocks.ActionClient {}
221+ tt .ActionClient .Test (t )
222+ tt .CertOps = & hcops.CertificateOps {ActionClient : tt .ActionClient , CertClient : tt .CertClient }
219223
220224 if tt .Mock != nil {
221225 tt .Mock (t , tt )
0 commit comments