Browse Source

test:提交单元测试

fuwencai 3 years ago
parent
commit
228df3a024
2 changed files with 35 additions and 4 deletions
  1. 14 4
      service/InstitutionService_test.go
  2. 21 0
      service/claim_test.go

+ 14 - 4
service/InstitutionService_test.go

@@ -13,7 +13,7 @@ var EntClaimSrv EntClaimService
 
 func init() {
 	entity.Mysql = &mysql.Mysql{
-		Address:      "192.168.3.14:4000",
+		Address:      "192.168.3.217:4000",
 		UserName:     "root",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		DBName:       "medical_fileld_data",
@@ -22,7 +22,7 @@ func init() {
 	}
 	entity.Mysql.Init()
 	BaseMysqlConn := &mysql.Mysql{
-		Address:      "192.168.3.14:4000",
+		Address:      "192.168.3.217:4000",
 		UserName:     "root",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		DBName:       "base_service",
@@ -30,9 +30,19 @@ func init() {
 		MaxIdleConns: 5,
 	}
 	BaseMysqlConn.Init()
+	CommonMysqlConn := &mysql.Mysql{
+		Address:      "192.168.3.217:4000",
+		UserName:     "root",
+		PassWord:     "=PDT49#80Z!RVv52_z",
+		DBName:       "global_common_data",
+		MaxOpenConns: 5,
+		MaxIdleConns: 5,
+	}
+	CommonMysqlConn.Init()
 	MyConn := entity.Conn{
-		Mysql:     entity.Mysql,
-		BaseMysql: BaseMysqlConn,
+		Mysql:            entity.Mysql,
+		BaseMysql:        BaseMysqlConn,
+		GlobalCommonData: CommonMysqlConn,
 	}
 	EntClaimSrv = *NewEntClaimSrv(&MyConn)
 	elastic.InitElasticSize("http://192.168.3.206:9800", 5)

+ 21 - 0
service/claim_test.go

@@ -175,3 +175,24 @@ func TestName(t *testing.T) {
 	//s1 := encrypt.SE.Encode2Hex(common.ObjToString("001d050b"))
 	fmt.Print(s, 2)
 }
+
+func TestEntClaimService_GetInstitutionByIds(t *testing.T) {
+
+	type args struct {
+		ids []string
+	}
+	tests := []struct {
+		name string
+		args args
+	}{
+		{
+			"获取企业基本信息", args{ids: []string{"2c55e97a56d53b763ed716ec119a8051", "6e29fb15f21afe82692dc95ba018f56a"}},
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got := EntClaimSrv.GetInstitutionByIds(tt.args.ids)
+			t.Log(got)
+		})
+	}
+}