-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdynamodb_table_config_test.go
60 lines (44 loc) · 1.18 KB
/
dynamodb_table_config_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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package remoteconfig
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
const (
VALID_DYNAMODB_TABLE_TABLENAME string = "testTable"
)
type DynamoDBTableConfigSuite struct {
suite.Suite
}
func TestDynamoDBTableConfigSuite(t *testing.T) {
suite.Run(t, new(DynamoDBTableConfigSuite))
}
func (s *DynamoDBTableConfigSuite) SetupSuite() {
}
func (s *DynamoDBTableConfigSuite) SetupTest() {
}
func (s *DynamoDBTableConfigSuite) TestValidate() {
tableName := VALID_DYNAMODB_TABLE_TABLENAME
d := &DynamoDBTableConfig{
TableName: &tableName,
}
err := validateConfigWithReflection(d)
assert.Nil(s.T(), err)
}
func (s *DynamoDBTableConfigSuite) TestValidateErrorTableName() {
tableName := ""
d := &DynamoDBTableConfig{
TableName: &tableName,
}
err := validateConfigWithReflection(d)
assert.NotNil(s.T(), err)
assert.Equal(s.T(), errors.New("String Field: TableName, contains an empty string"), err)
}
func (s *DynamoDBTableConfigSuite) TestGetTableName() {
tableName := VALID_DYNAMODB_TABLE_TABLENAME
d := &DynamoDBTableConfig{
TableName: &tableName,
}
assert.Equal(s.T(), VALID_DYNAMODB_TABLE_TABLENAME, d.GetTableName())
}