equipment_test.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package service
  2. //func TestDeviceStatistics_GetDeviceStatistics(t *testing.T) {
  3. // type fields struct {
  4. // BaseModel BaseModel
  5. // BaseEquipment int
  6. // LaboratoryEquipment int
  7. // UseTime float64
  8. // ExperimentalData int
  9. // }
  10. // type args struct {
  11. // ctx context.Context
  12. // req *BaseModel
  13. // }
  14. // base := new(DeviceStatistics)
  15. // arg := args{
  16. // ctx: context.TODO(),
  17. // req: &BaseModel{LaboratoryId: 1},
  18. // }
  19. // tests := []struct {
  20. // name string
  21. // fields *DeviceStatistics
  22. // args args
  23. // want *DeviceStatistics
  24. // wantErr bool
  25. // }{
  26. // {"读取实验数据测试1", base, arg, nil, false},
  27. // }
  28. // for _, tt := range tests {
  29. // t.Run(tt.name, func(t *testing.T) {
  30. // d := &DeviceStatistics{
  31. // BaseModel: tt.fields.BaseModel,
  32. // BaseEquipment: tt.fields.BaseEquipment,
  33. // LaboratoryEquipment: tt.fields.LaboratoryEquipment,
  34. // UseTime: tt.fields.UseTime,
  35. // ExperimentalData: tt.fields.ExperimentalData,
  36. // }
  37. // got, err := d.GetDeviceStatistics(tt.args.ctx, tt.args.req)
  38. // if (err != nil) != tt.wantErr {
  39. // t.Errorf("GetDeviceStatistics() error = %v, wantErr %v", err, tt.wantErr)
  40. // return
  41. // }
  42. // if !reflect.DeepEqual(got, tt.want) {
  43. // t.Errorf("GetDeviceStatistics() got = %v, want %v", got, tt.want)
  44. // }
  45. // })
  46. // }
  47. //}
  48. //func Test_Open(t *testing.T) {
  49. // var producer *nsq.Producer
  50. // cfg := nsq.NewConfig()
  51. // nsqdtcpaddr := "47.92.249.239:9150"
  52. // //nsqdtcpaddr := "127.0.0.1:4150"
  53. // producer, _ = nsq.NewProducer(nsqdtcpaddr, cfg)
  54. // now := gtime.Now().String()
  55. // //data := `{"operation_type":"1","sign_type":"1","mac":"33343538","device_type":"2","upload_time":"`+now+`","tenant":"CU7zm9WhZm","data":{"socket":"01","socket_hole":"01","uuid":"1394819d","operate":"01"}}`
  56. // data := `{"operation_type":"1","sign_type":"1","tenant":"vojPzh3Ct9","mac":"1181","device_type":"","upload_time":"`+now+`","uuid":"uuid","data":{"socket":"30303030","socket_hole":"01","uuid":"ab077b7b","operate":"01","last_time":""}}`
  57. // //data := `{"operation_type":"1","sign_type":"2","tenant":"CU7zm9WhZm","mac":"33343538","device_type":"2","ad_time":"`+now+`","data":{"socket":"01","socket_hole":"01","uuid":"ab077b7b","operate":"01"}}`
  58. // producer.Publish("socket02_cmd", []byte(data))
  59. //}