|
@@ -17,6 +17,7 @@ import (
|
|
var (
|
|
var (
|
|
apiurl = "http://127.0.0.1:8080/sfis/api/v1/projectList"
|
|
apiurl = "http://127.0.0.1:8080/sfis/api/v1/projectList"
|
|
// apiurl = "http://127.0.0.1:8080/sfis/api/v1/projectListDetail"
|
|
// apiurl = "http://127.0.0.1:8080/sfis/api/v1/projectListDetail"
|
|
|
|
+ SE = utils.SimpleEncrypt{Key: "topJYBX2019"}
|
|
)
|
|
)
|
|
|
|
|
|
func Test_ProjectListApi(t *testing.T) {
|
|
func Test_ProjectListApi(t *testing.T) {
|
|
@@ -47,13 +48,13 @@ func Test_Project(t *testing.T) {
|
|
func getData1(n int) {
|
|
func getData1(n int) {
|
|
appID := "sfGSVYRQMAAgkGBAUBJg4f"
|
|
appID := "sfGSVYRQMAAgkGBAUBJg4f"
|
|
secretKey := "364xw909"
|
|
secretKey := "364xw909"
|
|
- projectName := "河南省地税局2021年信息化建设招标项目"
|
|
|
|
- winner := "河南拓普计算机" + fmt.Sprint(n)
|
|
|
|
- zbRq := "2020-12-02"
|
|
|
|
|
|
+ projectName := "郑州航空港区富士"
|
|
|
|
+ winner := "中铁十五局集团有限公司"
|
|
|
|
+ zbRq := "2019-07-15"
|
|
data := make(url.Values)
|
|
data := make(url.Values)
|
|
- data["projectName"] = []string{projectName}
|
|
|
|
|
|
+ data["project_name"] = []string{projectName}
|
|
data["winner"] = []string{winner}
|
|
data["winner"] = []string{winner}
|
|
- data["zbRq"] = []string{zbRq}
|
|
|
|
|
|
+ data["bid_time"] = []string{zbRq}
|
|
data["app_id"] = []string{appID}
|
|
data["app_id"] = []string{appID}
|
|
now := time.Now().Unix()
|
|
now := time.Now().Unix()
|
|
bs, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectList", map[string]string{
|
|
bs, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectList", map[string]string{
|
|
@@ -63,6 +64,68 @@ func getData1(n int) {
|
|
log.Print(string(bs))
|
|
log.Print(string(bs))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func Test_ProjectList(t *testing.T) {
|
|
|
|
+ appID := "sfGSVYRQMAAgkGBAUBJg4f"
|
|
|
|
+ secretKey := "364xw909"
|
|
|
|
+ projectName := "洛阳市东环路"
|
|
|
|
+ winner := "中铁十五局集团有限公司"
|
|
|
|
+ bidTime1 := "2020-01-14"
|
|
|
|
+ bidTime := "2020-06-30"
|
|
|
|
+ bidTime3 := "2020-09-01"
|
|
|
|
+ // 中标日期 项目名称 中标单位
|
|
|
|
+ data := make(url.Values)
|
|
|
|
+ data["project_name"] = []string{projectName}
|
|
|
|
+ data["winner"] = []string{winner}
|
|
|
|
+ data["bid_time"] = []string{bidTime1}
|
|
|
|
+ data["app_id"] = []string{appID}
|
|
|
|
+ now := time.Now().Unix()
|
|
|
|
+ bs, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectList", map[string]string{
|
|
|
|
+ "token": utils.MD5(fmt.Sprintf("%s%d%s", appID, now, secretKey)),
|
|
|
|
+ "timestamp": fmt.Sprint(now),
|
|
|
|
+ }, data)
|
|
|
|
+ log.Print(string(bs))
|
|
|
|
+ // 中标日期 项目名称
|
|
|
|
+ data2 := make(url.Values)
|
|
|
|
+ data2["project_name"] = []string{projectName}
|
|
|
|
+ data2["bid_time"] = []string{bidTime}
|
|
|
|
+ data2["app_id"] = []string{appID}
|
|
|
|
+ now2 := time.Now().Unix()
|
|
|
|
+ bs2, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectList", map[string]string{
|
|
|
|
+ "token": utils.MD5(fmt.Sprintf("%s%d%s", appID, now2, secretKey)),
|
|
|
|
+ "timestamp": fmt.Sprint(now2),
|
|
|
|
+ }, data2)
|
|
|
|
+ log.Print(string(bs2))
|
|
|
|
+ // 中标日期 中标单位
|
|
|
|
+ data3 := make(url.Values)
|
|
|
|
+ data3["winner"] = []string{winner}
|
|
|
|
+ data3["bid_time"] = []string{bidTime3}
|
|
|
|
+ data3["app_id"] = []string{appID}
|
|
|
|
+ now3 := time.Now().Unix()
|
|
|
|
+ bs3, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectList", map[string]string{
|
|
|
|
+ "token": utils.MD5(fmt.Sprintf("%s%d%s", appID, now3, secretKey)),
|
|
|
|
+ "timestamp": fmt.Sprint(now2),
|
|
|
|
+ }, data3)
|
|
|
|
+ log.Print(string(bs3))
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+// 列表详情测试用例
|
|
|
|
+func Test_ProjectListDetail(t *testing.T) {
|
|
|
|
+ appID := "sfGSVYRQMAAgkGBAUBJg4f"
|
|
|
|
+ secretKey := "364xw909"
|
|
|
|
+ data1 := make(url.Values)
|
|
|
|
+ data1["app_id"] = []string{appID}
|
|
|
|
+ data1["winner"] = []string{"中铁十五局集团有限公司"}
|
|
|
|
+
|
|
|
|
+ now := time.Now().Unix()
|
|
|
|
+ bs, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectListDetail", map[string]string{
|
|
|
|
+ "token": utils.MD5(fmt.Sprintf("%s%d%s", appID, now, secretKey)),
|
|
|
|
+ "timestamp": fmt.Sprint(now),
|
|
|
|
+ }, data1)
|
|
|
|
+ log.Print(string(bs))
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
func getData() {
|
|
func getData() {
|
|
data := post(apiurl, map[string]string{
|
|
data := post(apiurl, map[string]string{
|
|
"projectname": "河南大学",
|
|
"projectname": "河南大学",
|
|
@@ -73,15 +136,20 @@ func getData() {
|
|
}
|
|
}
|
|
|
|
|
|
//获取项目详情测试用例
|
|
//获取项目详情测试用例
|
|
-// func Test_ProjectDetails(t *testing.T) {
|
|
|
|
-// data := post("http://127.0.0.1:8080/sfis/api/v1/projectDetail", map[string]string{
|
|
|
|
-// "projectid": "5f6b4e12499cb0822d39c68f",
|
|
|
|
-// })
|
|
|
|
-// res := map[string]interface{}{}
|
|
|
|
-// s, _ := json.Marshal(data)
|
|
|
|
-// json.Unmarshal(s, &res)
|
|
|
|
-// log.Println("数据:", res)
|
|
|
|
-// }
|
|
|
|
|
|
+func Test_ProjectDetails(t *testing.T) {
|
|
|
|
+ appID := "sfPQRYRQMAAwcGBwYBCgcA"
|
|
|
|
+ secretKey := "a8Iws4mE"
|
|
|
|
+ data := make(url.Values)
|
|
|
|
+ projectId := SE.EncodeString("5f6b4e12499cb0822d39c68f")
|
|
|
|
+ data["project_id"] = []string{projectId}
|
|
|
|
+ data["app_id"] = []string{appID}
|
|
|
|
+ now := time.Now().Unix()
|
|
|
|
+ bs, _ := utils.HttpPostForm("http://localhost:8080/sfis/api/v1/projectDetail", map[string]string{
|
|
|
|
+ "token": utils.MD5(fmt.Sprintf("%s%d%s", appID, now, secretKey)),
|
|
|
|
+ "timestamp": fmt.Sprint(now),
|
|
|
|
+ }, data)
|
|
|
|
+ log.Print(string(bs))
|
|
|
|
+}
|
|
|
|
|
|
func post(url string, form map[string]string) (data map[string]interface{}) {
|
|
func post(url string, form map[string]string) (data map[string]interface{}) {
|
|
str := ""
|
|
str := ""
|