req_test.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. package third
  2. import (
  3. "testing"
  4. )
  5. func TestGetUserInfoPlus(t *testing.T) {
  6. type args struct {
  7. key string
  8. }
  9. tests := []struct {
  10. name string
  11. args args
  12. want bool
  13. wantErr bool
  14. }{
  15. // TODO: Add test cases.
  16. {
  17. name: "ok",
  18. args: args{""},
  19. want: true,
  20. wantErr: false,
  21. },
  22. }
  23. for _, tt := range tests {
  24. t.Run(tt.name, func(t *testing.T) {
  25. got, err := GetUserInfoPlus()
  26. if (err != nil) != tt.wantErr {
  27. t.Errorf("GetParseStatus() error = %v, wantErr %v", err, tt.wantErr)
  28. return
  29. }
  30. if got != tt.want {
  31. t.Errorf("GetParseStatus() got = %v, want %v", got, tt.want)
  32. }
  33. })
  34. }
  35. }
  36. func Test_GetRecords(t *testing.T) {
  37. type args struct {
  38. key string
  39. }
  40. tests := []struct {
  41. name string
  42. args args
  43. want bool
  44. wantErr bool
  45. }{
  46. // TODO: Add test cases.
  47. {
  48. name: "ok",
  49. args: args{"tzlbndf9pi7ebzky"},
  50. want: true,
  51. wantErr: false,
  52. },
  53. }
  54. for _, tt := range tests {
  55. t.Run(tt.name, func(t *testing.T) {
  56. got, err := GetRecords(tt.args.key)
  57. if (err != nil) != tt.wantErr {
  58. t.Errorf("getRecords() error = %v, wantErr %v", err, tt.wantErr)
  59. return
  60. }
  61. if got == nil {
  62. t.Errorf("getRecords() got = %v, want %v", got, tt.want)
  63. }
  64. })
  65. }
  66. }
  67. func TestPurchasePaperPlusProxy(t *testing.T) {
  68. type args struct {
  69. card string
  70. source string
  71. }
  72. tests := []struct {
  73. name string
  74. args args
  75. want *PurchasePaperPlusProxyRespondParam
  76. wantErr bool
  77. }{
  78. // TODO: Add test cases.
  79. {
  80. name: "ok",
  81. args: args{"tzlbndf9pi7ebzky", "https://blog.csdn.net/mopmgerg54mo/article/details/145314910"},
  82. wantErr: false,
  83. },
  84. }
  85. for _, tt := range tests {
  86. t.Run(tt.name, func(t *testing.T) {
  87. got, err := PurchasePaperPlusProxy(tt.args.card, tt.args.source)
  88. if (err != nil) != tt.wantErr {
  89. t.Errorf("PurchasePaperPlusProxy() error = %v, wantErr %v", err, tt.wantErr)
  90. return
  91. }
  92. if got.Code != 200 {
  93. t.Errorf("PurchasePaperPlusProxy() got = %v, want %v", got, tt.want)
  94. }
  95. })
  96. }
  97. }
  98. func TestGetTaskPrice(t *testing.T) {
  99. type args struct {
  100. source string
  101. }
  102. tests := []struct {
  103. name string
  104. args args
  105. want *GeTaskPriceRespondParam
  106. wantErr bool
  107. }{
  108. // TODO: Add test cases.
  109. {
  110. name: "ok",
  111. args: args{"https://blog.csdn.net/mopmgerg54mo/article/details/145314910"},
  112. wantErr: false,
  113. },
  114. }
  115. for _, tt := range tests {
  116. t.Run(tt.name, func(t *testing.T) {
  117. got, err := GetTaskPrice(tt.args.source)
  118. if (err != nil) != tt.wantErr {
  119. t.Errorf("GetTaskPrice() error = %v, wantErr %v", err, tt.wantErr)
  120. return
  121. }
  122. if got.Code != 200 {
  123. t.Errorf("GetTaskPrice() got = %v, want %v", got, tt.want)
  124. }
  125. })
  126. }
  127. }
  128. func TestGetCountProxy(t *testing.T) {
  129. type args struct {
  130. Key string
  131. }
  132. tests := []struct {
  133. name string
  134. args args
  135. want *GetCountProxyRespondParam
  136. wantErr bool
  137. }{
  138. // TODO: Add test cases.
  139. {
  140. name: "ok",
  141. args: args{"tzlbndf9pi7ebzky"},
  142. wantErr: false,
  143. },
  144. }
  145. for _, tt := range tests {
  146. t.Run(tt.name, func(t *testing.T) {
  147. got, err := GetCountProxy(tt.args.Key)
  148. if (err != nil) != tt.wantErr {
  149. t.Errorf("GetCountProxy() error = %v, wantErr %v", err, tt.wantErr)
  150. return
  151. }
  152. if got.Code != 200 {
  153. t.Errorf("GetCountProxy() got = %v, want %v", got, tt.want)
  154. }
  155. })
  156. }
  157. }