@@ -16,34 +16,35 @@ import (
16
16
"github.com/smallstep/assert"
17
17
"github.com/smallstep/certificates/authority"
18
18
"github.com/smallstep/certificates/authority/provisioner"
19
+ "github.com/smallstep/certificates/errs"
19
20
"github.com/smallstep/certificates/logging"
20
21
)
21
22
22
23
func TestRevokeRequestValidate (t * testing.T ) {
23
24
type test struct {
24
25
rr * RevokeRequest
25
- err * Error
26
+ err * errs. Error
26
27
}
27
28
tests := map [string ]test {
28
29
"error/missing serial" : {
29
30
rr : & RevokeRequest {},
30
- err : & Error {Err : errors .New ("missing serial" ), Status : http .StatusBadRequest },
31
+ err : & errs. Error {Err : errors .New ("missing serial" ), Status : http .StatusBadRequest },
31
32
},
32
33
"error/bad reasonCode" : {
33
34
rr : & RevokeRequest {
34
35
Serial : "sn" ,
35
36
ReasonCode : 15 ,
36
37
Passive : true ,
37
38
},
38
- err : & Error {Err : errors .New ("reasonCode out of bounds" ), Status : http .StatusBadRequest },
39
+ err : & errs. Error {Err : errors .New ("reasonCode out of bounds" ), Status : http .StatusBadRequest },
39
40
},
40
41
"error/non-passive not implemented" : {
41
42
rr : & RevokeRequest {
42
43
Serial : "sn" ,
43
44
ReasonCode : 8 ,
44
45
Passive : false ,
45
46
},
46
- err : & Error {Err : errors .New ("non-passive revocation not implemented" ), Status : http .StatusNotImplemented },
47
+ err : & errs. Error {Err : errors .New ("non-passive revocation not implemented" ), Status : http .StatusNotImplemented },
47
48
},
48
49
"ok" : {
49
50
rr : & RevokeRequest {
@@ -57,7 +58,7 @@ func TestRevokeRequestValidate(t *testing.T) {
57
58
t .Run (name , func (t * testing.T ) {
58
59
if err := tc .rr .Validate (); err != nil {
59
60
switch v := err .(type ) {
60
- case * Error :
61
+ case * errs. Error :
61
62
assert .HasPrefix (t , v .Error (), tc .err .Error ())
62
63
assert .Equals (t , v .StatusCode (), tc .err .Status )
63
64
default :
@@ -189,7 +190,7 @@ func Test_caHandler_Revoke(t *testing.T) {
189
190
return nil , nil
190
191
},
191
192
revoke : func (ctx context.Context , opts * authority.RevokeOptions ) error {
192
- return InternalServerError (errors .New ("force" ))
193
+ return errs . InternalServerError (errors .New ("force" ))
193
194
},
194
195
},
195
196
}
0 commit comments