-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathyousign_test.go
47 lines (35 loc) · 1018 Bytes
/
yousign_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package yousign
import (
"bytes"
"io"
"net/http"
"testing"
"github.com/bxcodec/faker/v3"
"github.com/stretchr/testify/assert"
)
var (
client = NewClientStaging("STAGING-KEY")
)
func fatal(t *testing.T, err error, resp *http.Response) {
var b bytes.Buffer
io.Copy(&b, resp.Body)
t.Fatalf("error %v : %s", err, b.String())
}
func TestCorrectStagingSigningURL(t *testing.T) {
assert := assert.New(t)
apiKey := faker.UUIDHyphenated()
client := NewClientStaging(apiKey)
memberID := faker.UUIDHyphenated()
signURL := client.SignURL(memberID)
expectedURL := "https://staging-app.yousign.com/procedure/sign?members=" + memberID
assert.Equal(expectedURL, signURL)
}
func TestCorrectProductionSigningURL(t *testing.T) {
assert := assert.New(t)
apiKey := faker.UUIDHyphenated()
client := NewClient(apiKey)
memberID := faker.UUIDHyphenated()
signURL := client.SignURL(memberID)
expectedURL := "https://webapp.yousign.com/procedure/sign?members=" + memberID
assert.Equal(expectedURL, signURL)
}