cryptutil: use bytes for hmac (#2067)

This commit is contained in:
Caleb Doxsey 2021-04-07 14:57:24 -06:00 committed by GitHub
parent a935c1ba30
commit a51c7140ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 28 additions and 28 deletions

View file

@ -125,13 +125,13 @@ func TestValidateSignature(t *testing.T) {
tests := []struct {
name string
secretA string
secretB string
secretA []byte
secretB []byte
wantStatus int
wantBody string
}{
{"good", "secret", "secret", http.StatusOK, http.StatusText(http.StatusOK)},
{"secret mistmatch", "secret", "hunter42", http.StatusBadRequest, "{\"Status\":400,\"Error\":\"Bad Request: internal/urlutil: hmac failed\"}\n"},
{"good", []byte("secret"), []byte("secret"), http.StatusOK, http.StatusText(http.StatusOK)},
{"secret mistmatch", []byte("secret"), []byte("hunter42"), http.StatusBadRequest, "{\"Status\":400,\"Error\":\"Bad Request: internal/urlutil: hmac failed\"}\n"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {