作者 陈志颖

chore:使用https

... ... @@ -4,8 +4,8 @@ import "os"
const SERVICE_NAME = "mmm-worth"
var ABILITY_SERVICE_HOST = "https://suplus-worth-app-gateway-dev.fjmaimaimai.com"
var MMM_OPEN_API_SERVICE_HOST = "http://mmm-open-api-dev.fjmaimaimai.com"
var ABILITY_SERVICE_HOST = "://suplus-worth-app-gateway-dev.fjmaimaimai.com"
var MMM_OPEN_API_SERVICE_HOST = "https://mmm-open-api-dev.fjmaimaimai.com"
var LOG_LEVEL = "debug"
var LOG_File = "logs/app.log"
... ...
/**
@author: stevechan
@date: 2021/2/25
@note:
**/
package exchange_list
... ...
package exchange_list
import (
"net/http"
"os"
"strconv"
"time"
"github.com/gavv/httpexpect"
"github.com/go-pg/pg"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
)
var _ = Describe("导入素币兑换清单", func() {
var (
activityId int64
)
BeforeEach(func() {
_, err1 := pG.DB.QueryOne(
pg.Scan(&activityId),
"INSERT INTO exchange_cash_activities ( company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time",
101, "测试活动", "2021-02-08 15:59:59+00:00:00", 0, 0, 0, 5.1, time.Now())
Expect(err1).NotTo(HaveOccurred())
})
Describe("通过excel文件导入素币兑换清单", func() {
Context("传入有效的素币兑换清单文件", func() {
It("返回素币兑换清单导入结果", func() {
activityIdStr := strconv.FormatInt(activityId, 10)
fh, _ := os.Open("./files/素币兑换清单模板.xlsx")
httpExpect := httpexpect.New(GinkgoT(), server.URL)
httpExpect.POST("/cash-pool/activity/exchange-list/import").
WithFormField("where", "{\"activityId\": \""+activityIdStr+"\", \"uid\": 3289819024952064}").
WithFile("file", "素币兑换清单模板.xlsx", fh).
Expect().
Status(http.StatusOK).
JSON().
Object().
ContainsKey("code").ValueEqual("code", 0).
ContainsKey("msg").ValueEqual("msg", "ok").
ContainsKey("data").Value("data").Object()
_ = fh.Close()
})
})
})
AfterEach(func() {
_, err := pG.DB.Exec("DELETE FROM exchange_cash_person_lists WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})
... ...