forked from statping/statping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoauth_test.go
45 lines (42 loc) · 1.05 KB
/
oauth_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
package handlers
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestOAuthRoutes(t *testing.T) {
tests := []HTTPTest{
{
Name: "OAuth Save",
URL: "/api/oauth",
Body: `{
"gh_client_id": "githubid",
"gh_client_secret": "githubsecret",
"google_client_id": "googleid",
"google_client_secret": "googlesecret",
"oauth_domains": "gmail.com,yahoo.com,socialeck.com",
"oauth_providers": "local,slack,google,github",
"slack_client_id": "example.iddd",
"slack_client_secret": "exampleeesecret",
"slack_team": "dev"
}`,
Method: "POST",
ExpectedStatus: 200,
BeforeTest: SetTestENV,
},
{
Name: "OAuth Values",
URL: "/api/oauth",
Method: "GET",
ExpectedStatus: 200,
ExpectedContains: []string{`"slack_client_id":"example.iddd"`},
AfterTest: UnsetTestENV,
},
}
for _, v := range tests {
t.Run(v.Name, func(t *testing.T) {
res, t, err := RunHTTPTest(v, t)
assert.Nil(t, err)
t.Log(res)
})
}
}