CreateAppInfo_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package v1
  2. import (
  3. "metawant.greentech.com.cn/gaoyagang/gt-common/datacenter_client"
  4. "metawant.greentech.com.cn/gaoyagang/gt-common/httplib"
  5. "testing"
  6. )
  7. var d = NewDcApi(ClientOptions{
  8. HTTPSettings: httplib.HTTPSettings{},
  9. ServerIp: "47.96.12.136:8788",
  10. AppName: "simulations",
  11. AppSecret: "e3fc084fda3d2a6628b9ce28abf21243",
  12. })
  13. func TestDcApi_CreateAppInfo(t *testing.T) {
  14. got, err := d.CreateAppInfo(datacenter_client.CreateAppInfoReq{
  15. ProjectId: 0,
  16. AppName: "add-test1",
  17. ProjectIds: []int64{92, 46, 1187},
  18. Expire: 30 * 86400,
  19. })
  20. t.Log(got, err)
  21. }
  22. func TestDcApi_FindList(t *testing.T) {
  23. got, err := d.FindAppList(datacenter_client.FindAppListReq{
  24. ProjectId: 0,
  25. Page: 1,
  26. PageSize: 10,
  27. Order: "id desc",
  28. })
  29. t.Log(got, err)
  30. }
  31. func TestDcApi_GetAppInfo(t *testing.T) {
  32. got, err := d.GetAppInfo(datacenter_client.GetAppInfoReq{
  33. ProjectId: 0,
  34. AppName: "add-test1",
  35. })
  36. t.Log(got, err)
  37. }
  38. func TestDcApi_EnableAppInfo(t *testing.T) {
  39. got, err := d.EnableAppInfo(datacenter_client.EnableAppInfoReq{
  40. ProjectId: 0,
  41. AppName: "add-test1",
  42. })
  43. t.Log(got, err)
  44. }
  45. func TestDcApi_DisableAppInfo(t *testing.T) {
  46. got, err := d.DisableAppInfo(datacenter_client.DisableAppInfoReq{
  47. ProjectId: 0,
  48. AppName: "add-test",
  49. })
  50. t.Log(got, err)
  51. }
  52. func TestDcApi_ResetAppProject(t *testing.T) {
  53. got, err := d.ResetAppProject(datacenter_client.ResetAppProjectReq{
  54. ProjectId: 0,
  55. AppName: "add-test",
  56. ProjectIds: []int64{1, 3, 5, 7, 9},
  57. })
  58. t.Log(got, err)
  59. }
  60. func TestDcApi_ExpireAppSecret(t *testing.T) {
  61. got, err := d.ExpireAppSecret(datacenter_client.ExpireAppSecretReq{
  62. ProjectId: 0,
  63. AppName: "add-test",
  64. Expire: 86400 * 30,
  65. })
  66. t.Log(got, err)
  67. }
  68. func TestDcApi_ResetAppSecret(t *testing.T) {
  69. got, err := d.ResetAppSecret(datacenter_client.ResetAppSecretReq{
  70. ProjectId: 0,
  71. AppName: "add-test",
  72. })
  73. t.Log(got, err)
  74. }
  75. func TestDcApi_RemoveAppInfo(t *testing.T) {
  76. got, err := d.RemoveAppInfo(datacenter_client.RemoveAppInfoReq{
  77. ProjectId: 0,
  78. AppName: "add-test",
  79. })
  80. t.Log(got, err)
  81. }
  82. func TestDcApi_FindDataDescribe(t *testing.T) {
  83. got, err := d.FindDataDescribe(datacenter_client.FindDataDescribeReq{
  84. ProjectId: 92,
  85. Items: []string{"x1", "x2"},
  86. Stime: "2024-03-25 05:00:00",
  87. Etime: "2024-03-25 11:00:00",
  88. })
  89. t.Log(got, err)
  90. }
  91. func TestDcApi_FindDataCorrelation(t *testing.T) {
  92. got, err := d.FindDataCorrelation(datacenter_client.FindDataCorrelationReq{
  93. ProjectId: 92,
  94. Items: []string{"x1", "x2"},
  95. Stime: "2024-03-25 05:00:00",
  96. Etime: "2024-03-25 11:00:00",
  97. })
  98. t.Log(got, err)
  99. }
  100. func TestDcApi_FindDataMinAndMax(t *testing.T) {
  101. got, err := d.FindDataMinAndMax(datacenter_client.FindDataMinAndMaxReq{
  102. ProjectId: 92,
  103. Items: []string{"x1", "x2"},
  104. Stime: "2024-03-25 05:00:00",
  105. Etime: "2024-03-25 18:00:00",
  106. })
  107. t.Log(got, err)
  108. }