forked from vickxxx/appstore
-
Notifications
You must be signed in to change notification settings - Fork 3
/
config_test.go
36 lines (31 loc) · 1.15 KB
/
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
package appstore
import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"testing"
)
type ConfigTestSuite struct {
suite.Suite
}
func (suite *ConfigTestSuite) TestNewConfig() {
result := NewConfig("foo", "bar", "baz", "tmp/key.p8")
assert.Equal(suite.T(), AppStoreConnectAPIProductionUri, result.Uri)
assert.Equal(suite.T(), "foo", result.IssuerId)
assert.Equal(suite.T(), "bar", result.KeyId)
assert.Equal(suite.T(), "baz", result.VendorNo)
assert.Equal(suite.T(), "tmp/key.p8", result.PrivateKey)
assert.Equal(suite.T(), "JWT", result.Token.Type)
assert.Equal(suite.T(), "ES256", result.Token.Algo)
assert.Equal(suite.T(), AppStoreConnectAPIAudience, result.Token.Audience)
assert.Equal(suite.T(), AppStoreConnectAPITokenTtl, result.Token.Ttl)
}
func (suite *ConfigTestSuite) TestNewTokenConfig() {
result := NewTokenConfig()
assert.Equal(suite.T(), "JWT", result.Type)
assert.Equal(suite.T(), "ES256", result.Algo)
assert.Equal(suite.T(), AppStoreConnectAPIAudience, result.Audience)
assert.Equal(suite.T(), AppStoreConnectAPITokenTtl, result.Ttl)
}
func TestConfigTestSuite(t *testing.T) {
suite.Run(t, new(ConfigTestSuite))
}