package clod import ( "Cold_Logistic/internal/pkg/common/options" "context" "testing" ) func init() { options.OptInstance = &options.Options{ BzdClod: &options.BzdOption{ Host: "https://cold.coldbaozhida.com", DataListUrl: "/api/v3/Data/List", DeviceSensorList: "/api/v3/DeviceSensor/List", UserList: "/api/v3/User/List", LogisticCompanyList: "/api/v3/Company/Transport/List", }, } } func TestBzdClodService_LoginVerification(t *testing.T) { srv := NewBzdClodService() tokenKey := "f8904b38-c6fd-48c1-a513-96647abaa880" ok, pid, user, err := srv.LoginVerification(context.Background(), tokenKey) if err != nil { t.Fatalf("err: %v", err) } if !ok { t.Errorf("验证失败") return } t.Logf("pid: %v", pid) t.Logf("%+v", user) } func TestBzdClodService_DeviceSensorList(t *testing.T) { srv := NewBzdClodService() got, err := srv.DeviceSensorList(context.Background(), "2023143077448236") if err != nil { t.Fatalf("err: %v", err) } t.Logf("%v", got) } func TestBzdClodService_MonitorDataList(t *testing.T) { srv := NewBzdClodService() got, err := srv.DeviceSensorDataList(context.Background(), DeviceSensorDataListParam{ User_tokey: "97b59da7-b9c2-4b39-bd5-b02d53190448", T_snid: "2023143077448236,0", Time_start: "2024-2-29 00:00:00", Time_end: "2024-02-29 15:47:35", Page: "1", Page_z: "5", }) if err != nil { t.Fatalf("err: %v", err) } t.Logf("%v", got) } func TestBzdClodService_UserList(t *testing.T) { srv := NewBzdClodService() got, err := srv.UserList(context.Background(), UserListParam{ UserToken: "6f37e1cd-0b04-497a-96e4-ad6bc3e81ee9", Name: "", Page: 1, Page_z: 20, }) if err != nil { t.Fatalf("err: %v", err) } t.Logf("%v", got) } func TestBzdClodService_LogisticCompanyList(t *testing.T) { srv := NewBzdClodService() got, err := srv.LogisticCompanyList(context.Background(), LogisticCompanyListParam{ UserTokey: "bad2cb8b-bb9a-4541-a751-13c2528f85f2", TName: "", Page: 0, Page_z: 0, }) if err != nil { t.Fatalf("err: %v", err) } t.Logf("%v", got) }