Quellcode durchsuchen

ca: refactored to use the read package

Panagiotis Siatras vor 4 Jahren
Ursprung
Commit
9ba33bab4e
1 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 6 4
      ca/client_test.go

+ 6 - 4
ca/client_test.go

@@ -17,13 +17,15 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
+	"go.step.sm/crypto/x509util"
+	"golang.org/x/crypto/ssh"
+
 	"github.com/smallstep/assert"
 	"github.com/smallstep/assert"
 	"github.com/smallstep/certificates/api"
 	"github.com/smallstep/certificates/api"
+	"github.com/smallstep/certificates/api/read"
 	"github.com/smallstep/certificates/authority"
 	"github.com/smallstep/certificates/authority"
 	"github.com/smallstep/certificates/authority/provisioner"
 	"github.com/smallstep/certificates/authority/provisioner"
 	"github.com/smallstep/certificates/errs"
 	"github.com/smallstep/certificates/errs"
-	"go.step.sm/crypto/x509util"
-	"golang.org/x/crypto/ssh"
 )
 )
 
 
 const (
 const (
@@ -354,7 +356,7 @@ func TestClient_Sign(t *testing.T) {
 
 
 			srv.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			srv.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 				body := new(api.SignRequest)
 				body := new(api.SignRequest)
-				if err := api.ReadJSON(req.Body, body); err != nil {
+				if err := read.JSON(req.Body, body); err != nil {
 					e, ok := tt.response.(error)
 					e, ok := tt.response.(error)
 					assert.Fatal(t, ok, "response expected to be error type")
 					assert.Fatal(t, ok, "response expected to be error type")
 					api.WriteError(w, e)
 					api.WriteError(w, e)
@@ -426,7 +428,7 @@ func TestClient_Revoke(t *testing.T) {
 
 
 			srv.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 			srv.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
 				body := new(api.RevokeRequest)
 				body := new(api.RevokeRequest)
-				if err := api.ReadJSON(req.Body, body); err != nil {
+				if err := read.JSON(req.Body, body); err != nil {
 					e, ok := tt.response.(error)
 					e, ok := tt.response.(error)
 					assert.Fatal(t, ok, "response expected to be error type")
 					assert.Fatal(t, ok, "response expected to be error type")
 					api.WriteError(w, e)
 					api.WriteError(w, e)