diff --git a/cli/cli.go b/cli/cli.go index 1e09c54..eb030a1 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -143,7 +143,7 @@ func unmarshalRequest(ctx context.Context, request any) error { func marshalResponse(ctx context.Context, response any, err error) (string, *plugin.Error) { logger := log.GetLogger(ctx) if err != nil { - logger.Errorf("%s error :%v", reflect.TypeOf(response), err) + logger.Errorf("%s error: %v", reflect.TypeOf(response), err) if plgErr, ok := err.(*plugin.Error); ok { return "", plgErr } @@ -157,6 +157,6 @@ func marshalResponse(ctx context.Context, response any, err error) (string, *plu return "", plugin.NewGenericErrorf(plugin.ErrorMsgMalformedOutputFmt, err.Error()) } - logger.Debugf("%s response :%s", reflect.TypeOf(response), jsonResponse) + logger.Debugf("%s response: %s", reflect.TypeOf(response), jsonResponse) return string(jsonResponse), nil } diff --git a/cli/cli_test.go b/cli/cli_test.go index a5bdf9a..3049826 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -106,27 +106,6 @@ func setupReader(content string) func() { } } -//func TestUnmarshalRequest(t *testing.T) { -// ctx := context.Background() -// req := plugin.GenerateSignatureRequest{ -// ContractVersion: "1.0", -// KeyID: "keyId", -// KeySpec: plugin.KeySpecEC384, -// Hash: plugin.HashAlgorithmSHA384, -// Payload: []byte("payload"), -// } -// -// err := unmarshalRequest(ctx, req) -// if err != nil { -// t.Errorf("Error found in marshalResponse: %v", err) -// } -// -// expected := "{\"signatureEnvelope\":\"ZW52ZWxvcGU=\",\"signatureEnvelopeType\":\"envelopeType\",\"annotations\":{\"key\":\"value\"}}" -// if !strings.EqualFold("{\"signatureEnvelope\":\"ZW52ZWxvcGU=\",\"signatureEnvelopeType\":\"envelopeType\",\"annotations\":{\"key\":\"value\"}}", op) { -// t.Errorf("Not equal: \n expected: %s\n actual : %s", expected, op) -// } -//} - func assertErr(t *testing.T, err error, code plugin.Code) { if plgErr, ok := err.(*plugin.Error); ok { if reflect.DeepEqual(code, plgErr.ErrCode) {