-
Notifications
You must be signed in to change notification settings - Fork 9
/
login_role_test.go
38 lines (27 loc) · 1.02 KB
/
login_role_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
package alks
import (
. "github.com/motain/gocheck"
)
func (s *S) Test_GetMyLoginRole(c *C) {
testServer.Response(200, nil, getIamLoginRoleResponse)
oldCreds := s.client.Credentials
s.client.Credentials = &STS{AccessKey: "abc", SecretKey: "123", SessionToken: "abc123"}
resp, err := s.client.GetMyLoginRole()
_ = testServer.WaitRequest()
c.Assert(resp.LoginRole.Account, Equals, "012345678910/ALKSAdmin")
c.Assert(resp.LoginRole.IamKeyActive, Equals, true)
c.Assert(resp.LoginRole.MaxKeyDuration, Equals, 36)
c.Assert(resp.LoginRole.Role, Equals, "Admin")
c.Assert(err, IsNil)
s.client.Credentials = oldCreds
}
func (s *S) Test_GetLoginRole(c *C) {
testServer.Response(200, nil, getIamLoginRoleResponse)
resp, err := s.client.GetLoginRole()
_ = testServer.WaitRequest()
c.Assert(resp.LoginRole.Account, Equals, "012345678910/ALKSAdmin")
c.Assert(resp.LoginRole.IamKeyActive, Equals, true)
c.Assert(resp.LoginRole.MaxKeyDuration, Equals, 36)
c.Assert(resp.LoginRole.Role, Equals, "Admin")
c.Assert(err, IsNil)
}