123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- package v1
- import (
- "metawant.greentech.com.cn/gaoyagang/gt-common/datacenter_client"
- "metawant.greentech.com.cn/gaoyagang/gt-common/httplib"
- "testing"
- )
- var d = NewDcApi(ClientOptions{
- HTTPSettings: httplib.HTTPSettings{},
- ServerIp: "47.96.12.136:8788",
- AppName: "add-test1",
- AppSecret: "7395fb0cfasyvasd705a2db44a19851a3dbd77f",
- })
- func TestDcApi_CreateAppInfo(t *testing.T) {
- got, err := d.CreateAppInfo(datacenter_client.CreateAppInfoReq{
- ProjectId: 0,
- AppName: "add-test1",
- ProjectIds: []int64{92, 46, 1187},
- Expire: 30 * 86400,
- })
- t.Log(got, err)
- }
- func TestDcApi_FindList(t *testing.T) {
- got, err := d.FindAppList(datacenter_client.FindAppListReq{
- ProjectId: 0,
- Page: 1,
- PageSize: 10,
- Order: "id desc",
- })
- t.Log(got, err)
- }
- func TestDcApi_GetAppInfo(t *testing.T) {
- got, err := d.GetAppInfo(datacenter_client.GetAppInfoReq{
- ProjectId: 0,
- AppName: "add-test1",
- })
- t.Log(got, err)
- }
- func TestDcApi_EnableAppInfo(t *testing.T) {
- got, err := d.EnableAppInfo(datacenter_client.EnableAppInfoReq{
- ProjectId: 0,
- AppName: "add-test1",
- })
- t.Log(got, err)
- }
- func TestDcApi_DisableAppInfo(t *testing.T) {
- got, err := d.DisableAppInfo(datacenter_client.DisableAppInfoReq{
- ProjectId: 0,
- AppName: "add-test",
- })
- t.Log(got, err)
- }
- func TestDcApi_ResetAppProject(t *testing.T) {
- got, err := d.ResetAppProject(datacenter_client.ResetAppProjectReq{
- ProjectId: 0,
- AppName: "add-test",
- ProjectIds: []int64{1, 3, 5, 7, 9},
- })
- t.Log(got, err)
- }
- func TestDcApi_ExpireAppSecret(t *testing.T) {
- got, err := d.ExpireAppSecret(datacenter_client.ExpireAppSecretReq{
- ProjectId: 0,
- AppName: "add-test",
- Expire: 86400 * 30,
- })
- t.Log(got, err)
- }
- func TestDcApi_ResetAppSecret(t *testing.T) {
- got, err := d.ResetAppSecret(datacenter_client.ResetAppSecretReq{
- ProjectId: 0,
- AppName: "add-test",
- })
- t.Log(got, err)
- }
- func TestDcApi_RemoveAppInfo(t *testing.T) {
- got, err := d.RemoveAppInfo(datacenter_client.RemoveAppInfoReq{
- ProjectId: 0,
- AppName: "add-test",
- })
- t.Log(got, err)
- }
- func TestDcApi_FindDataDescribe(t *testing.T) {
- got, err := d.FindDataDescribe(datacenter_client.FindDataDescribeReq{
- ProjectId: 92,
- Items: []string{"x1", "x2"},
- Stime: "2024-03-25 05:00:00",
- Etime: "2024-03-25 11:00:00",
- })
- t.Log(got, err)
- }
- func TestDcApi_FindDataCorrelation(t *testing.T) {
- got, err := d.FindDataCorrelation(datacenter_client.FindDataCorrelationReq{
- ProjectId: 92,
- Items: []string{"x1", "x2"},
- Stime: "2024-03-25 05:00:00",
- Etime: "2024-03-25 11:00:00",
- })
- t.Log(got, err)
- }
- func TestDcApi_FindDataMinAndMax(t *testing.T) {
- got, err := d.FindDataMinAndMax(datacenter_client.FindDataMinAndMaxReq{
- ProjectId: 92,
- Items: []string{"x1", "x2"},
- Stime: "2024-03-25 05:00:00",
- Etime: "2024-03-25 18:00:00",
- })
- t.Log(got, err)
- }
|