2024-08-22 23:03:38 +02:00
|
|
|
package versiacrypto
|
2024-08-15 19:22:17 +02:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/url"
|
|
|
|
|
"testing"
|
2024-09-02 15:46:32 +02:00
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2024-08-15 19:22:17 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestFederationHeaders_String(t *testing.T) {
|
|
|
|
|
one := SignatureData{
|
|
|
|
|
RequestMethod: "POST",
|
|
|
|
|
Nonce: "1234567890",
|
|
|
|
|
URL: &url.URL{Scheme: "https", Host: "bob.com", Path: "/users/bob", RawQuery: "z=foo&a=bar"},
|
2024-09-02 15:46:32 +02:00
|
|
|
Digest: SHA256([]byte("hello")),
|
2024-08-15 19:22:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert.Equal(t, "post /users/bob?z=foo&a=bar 1234567890 LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=", one.String())
|
|
|
|
|
}
|