-
Notifications
You must be signed in to change notification settings - Fork 17
/
role_test.go
29 lines (23 loc) · 850 Bytes
/
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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewRoleArn(t *testing.T) {
assert := assert.New(t)
arn, err := newRoleArn("arn:aws:iam::123456789012:role/test-role-name")
assert.Nil(err)
assert.Equal("test-role-name", arn.RoleName())
assert.Equal("/", arn.Path())
assert.Equal("123456789012", arn.AccountID())
assert.Equal("arn:aws:iam::123456789012:role/test-role-name", arn.String())
}
func TestNewRoleArnWithPath(t *testing.T) {
assert := assert.New(t)
arn, err := newRoleArn("arn:aws:iam::123456789012:role/this/is/the/path/test-role-name")
assert.Nil(err)
assert.Equal("test-role-name", arn.RoleName())
assert.Equal("/this/is/the/path/", arn.Path())
assert.Equal("123456789012", arn.AccountID())
assert.Equal("arn:aws:iam::123456789012:role/this/is/the/path/test-role-name", arn.String())
}