-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions_test.go
More file actions
43 lines (34 loc) · 950 Bytes
/
options_test.go
File metadata and controls
43 lines (34 loc) · 950 Bytes
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
package awsmocker
import (
"testing"
"time"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/stretchr/testify/require"
)
func TestMockerOptions(t *testing.T) {
t.Run("WithVerbosity", func(t *testing.T) {
mo := newOptions()
WithVerbosity(true)(mo)
require.True(t, mo.Verbose)
WithVerbosity(false)(mo)
require.False(t, mo.Verbose)
})
t.Run("WithTimeout", func(t *testing.T) {
mo := newOptions()
WithTimeout(10 * time.Minute)(mo)
require.Equal(t, 10*time.Minute, mo.Timeout)
})
t.Run("WithoutDefaultMocks", func(t *testing.T) {
mo := newOptions()
WithEC2Metadata()(mo)
require.Contains(t, mo.Mocks, MockStsGetCallerIdentityValid)
WithoutDefaultMocks()(mo)
require.NotContains(t, mo.Mocks, MockStsGetCallerIdentityValid)
})
t.Run("WithAWSConfigOptions", func(t *testing.T) {
m := Start(t,
WithAWSConfigOptions(config.WithRegion("blah-yar")),
)
require.Equal(t, "blah-yar", m.Config().Region)
})
}