- Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathplatform_test.go
38 lines (29 loc) · 745 Bytes
/
platform_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
/*
2019 © Postgres.ai
*/
package platform
import (
"testing"
"github.com/stretchr/testify/assert"
)
funcTestIfPersonalTokenEnabled(t*testing.T) {
s:=Service{}
assert.Equal(t, s.IsPersonalTokenEnabled(), false)
s.cfg.EnablePersonalToken=true
assert.Equal(t, s.IsPersonalTokenEnabled(), true)
}
funcTestIfOrganizationIsAllowed(t*testing.T) {
s:=Service{}
assert.Equal(t, s.isAllowedOrganization(0), false)
s.token.OrganizationID=1
assert.Equal(t, s.isAllowedOrganization(0), false)
assert.Equal(t, s.isAllowedOrganization(1), true)
}
funcTestOriginURL(t*testing.T) {
s:=Service{
cfg: Config{
URL: "https://example.com:2345/api/path",
},
}
assert.Equal(t, "https://example.com:2345", s.OriginURL())
}