From 991afecdb88a87f2be3e1fa5459307693ef73b31 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 13 六月 2019 20:39:46 +0800
Subject: [PATCH] test
---
api_test.go | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/api_test.go b/api_test.go
index 3473da0..eefcf4c 100644
--- a/api_test.go
+++ b/api_test.go
@@ -1,7 +1,8 @@
package dbapi
import (
- "analyweb/protomsg"
+ "basic.com/pubsub/protomsg.git"
+ "encoding/json"
"fmt"
"testing"
"time"
@@ -9,7 +10,7 @@
func TestGetLocalCameraTree(t *testing.T) {
var api AreaApi
- body := api.GetLocalCameraTree(0, 0, "c")
+ body := api.GetLocalCameraTree("0", "0", "c")
fmt.Println(body)
}
@@ -19,8 +20,11 @@
Parentid: 0,
Name: "鍝堝搱鍝�",
}
+ dataBytes, _ := json.Marshal(area)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
- flag := api.AreaAdd(area)
+ flag := api.AreaAdd(paramBody)
fmt.Println(flag)
}
@@ -31,7 +35,10 @@
Name: "鍖哄煙鏇存柊娴嬭瘯",
Parentid: 0,
}
- flag := api.AreaUpdate(area)
+ dataBytes, _ := json.Marshal(area)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ flag := api.AreaUpdate(paramBody)
fmt.Println(flag)
}
@@ -47,7 +54,10 @@
Name:"娴嬭瘯鍟婂晩鍟婂晩鍟婂晩鍟婂晩",
Areaid:0,
}
- result := api.CameraAdd(camera)
+ dataBytes, _ := json.Marshal(camera)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ result := api.CameraAdd(paramBody)
fmt.Println("add result: ",result)
}
@@ -61,8 +71,11 @@
Icon:"bbb",
Url:"baidu",
}
- result := api.Save(sdk)
- fmt.Println("add result: ",result)
+ dataBytes, _ := json.Marshal(sdk)
+ paramBody := make(map[string]interface{},0)
+ json.Unmarshal(dataBytes,paramBody)
+ result,data := api.Save(paramBody)
+ fmt.Println("add result: ",result,data)
}
}
@@ -79,7 +92,7 @@
func TestSdkApi_GetById(t *testing.T) {
var api SdkApi
- model := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
+ model,_ := api.GetById("812b674b-2375-4589-919a-5c1c3278a97e")
fmt.Println(model)
}
@@ -99,4 +112,17 @@
var api CameraApi
cameras := api.FindAll()
fmt.Println(cameras)
+}
+
+//鏌ユ壘鎵�鏈夌殑澶氳竟褰�
+func TestCameraApi_FindAllPolygons(t *testing.T) {
+ var api CameraApi
+ data := api.FindAllPolygons()
+ fmt.Println("polygons:",data)
+}
+
+func TestCameraApi_FindAllTimeRules(t *testing.T) {
+ var api CameraApi
+ _, rules := api.FindAllTimeRules()
+ fmt.Println("timeRules:",rules)
}
\ No newline at end of file
--
Gitblit v1.8.0