...
1
2
3
4
5 package endpoints
6
7 import (
8 "testing"
9
10 "golang.org/x/oauth2"
11 )
12
13 func TestAWSCognitoEndpoint(t *testing.T) {
14
15 var endpointTests = []struct {
16 in string
17 out oauth2.Endpoint
18 }{
19 {
20 in: "https://testing.auth.us-east-1.amazoncognito.com",
21 out: oauth2.Endpoint{
22 AuthURL: "https://testing.auth.us-east-1.amazoncognito.com/oauth2/authorize",
23 TokenURL: "https://testing.auth.us-east-1.amazoncognito.com/oauth2/token",
24 },
25 },
26 {
27 in: "https://testing.auth.us-east-1.amazoncognito.com/",
28 out: oauth2.Endpoint{
29 AuthURL: "https://testing.auth.us-east-1.amazoncognito.com/oauth2/authorize",
30 TokenURL: "https://testing.auth.us-east-1.amazoncognito.com/oauth2/token",
31 },
32 },
33 }
34
35 for _, tt := range endpointTests {
36 t.Run(tt.in, func(t *testing.T) {
37 endpoint := AWSCognito(tt.in)
38 if endpoint != tt.out {
39 t.Errorf("got %q, want %q", endpoint, tt.out)
40 }
41 })
42 }
43 }
44
View as plain text