-
Notifications
You must be signed in to change notification settings - Fork 0
/
license_test.go
91 lines (81 loc) · 2.36 KB
/
license_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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package licenseSDK
import (
"github.com/ensaas/license-sdk/encryptor"
"github.com/ensaas/license-sdk/store/postgre"
"log"
"testing"
)
func TestNew(t *testing.T) {
licenseUrl := "http://api-license-ews.axa.wise-paas.com.cn/v1"
entor, err := encryptor.New("12345678912345678932145678781231")
if err != nil {
log.Fatalf(err.Error())
}
storeParams := map[string]interface{}{
postgre.Host: "localhost",
postgre.Port: "5432",
postgre.Username: "postgres",
postgre.Password: "",
postgre.DBName: "listing",
postgre.SSLMode: "disable",
postgre.MaxIdleConns: 10,
postgre.MaxOpenConns: 10,
}
pgStore, err := postgre.New(storeParams)
if err != nil {
log.Fatalf(err.Error())
}
New(pgStore, entor, licenseUrl)
}
func TestNewWithDefault(t *testing.T) {
licenseUrl := "http://api-license-ews.axa.wise-paas.com.cn/v1"
salt := "12345678912345678932145678781231"
storeParams := map[string]interface{}{
postgre.Host: "",
postgre.Port: "5432",
postgre.Username: "postgres",
postgre.Password: "",
postgre.DBName: "listing",
postgre.SSLMode: "disable",
postgre.MaxIdleConns: 10,
postgre.MaxOpenConns: 10,
}
NewWithDefault(storeParams, salt, licenseUrl)
}
func TestNewWithDefaultEncryptor(t *testing.T) {
licenseUrl := "http://api-license-ews.axa.wise-paas.com.cn/v1"
salt := "12345678912345678932145678781231"
storeParams := map[string]interface{}{
postgre.Host: "localhost",
postgre.Port: "5432",
postgre.Username: "postgres",
postgre.Password: "",
postgre.DBName: "listing",
postgre.SSLMode: "disable",
postgre.MaxIdleConns: 10,
postgre.MaxOpenConns: 10,
}
pgStore, err := postgre.New(storeParams)
if err != nil {
log.Fatalf(err.Error())
}
NewWithDefaultEncryptor(pgStore, salt, licenseUrl)
}
func TestNewWithDefaultStore(t *testing.T) {
licenseUrl := "http://api-license-ews.axa.wise-paas.com.cn/v1"
storeParams := map[string]interface{}{
postgre.Host: "localhost",
postgre.Port: "5432",
postgre.Username: "postgres",
postgre.Password: "",
postgre.DBName: "listing",
postgre.SSLMode: "disable",
postgre.MaxIdleConns: 10,
postgre.MaxOpenConns: 10,
}
entor, err := encryptor.New("")
if err != nil {
log.Fatalf(err.Error())
}
NewWithDefaultStore(entor, storeParams, licenseUrl)
}