xph_api_test.go 951 B

1234567891011121314151617181920212223242526272829303132333435
  1. package xphapi
  2. import (
  3. "encoding/json"
  4. "testing"
  5. )
  6. func TestXph_GetDeviceData(t *testing.T) {
  7. x := &Xph{
  8. baseUrl: "http://115.28.187.9:8005",
  9. back: nil,
  10. }
  11. token := "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIzOTYxMTQxNDIiLCJhdWQiOiJjb25zdW1lciIsImV4cCI6MTczNTIwMTI3N30.jWYVHhcDSbFTX9_W70mT6jW2MUF2ZwBMTVCx7YxXpT6mbuzjibhP9nZxoegOEyxZTGhAd9oqmj5RFU2mni31DQ"
  12. gotData, err := x.GetDeviceData("865012063142227", token)
  13. if err != nil {
  14. t.Error(err)
  15. t.Fatal(err)
  16. }
  17. str, err := json.Marshal(gotData)
  18. t.Log(string(str), err)
  19. }
  20. func TestXph_GetAllDevices(t *testing.T) {
  21. x := &Xph{
  22. baseUrl: "http://115.28.187.9:8005",
  23. back: nil,
  24. }
  25. token := "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIzOTYxMTQxNDIiLCJhdWQiOiJjb25zdW1lciIsImV4cCI6MTczNTIwMTI3N30.jWYVHhcDSbFTX9_W70mT6jW2MUF2ZwBMTVCx7YxXpT6mbuzjibhP9nZxoegOEyxZTGhAd9oqmj5RFU2mni31DQ"
  26. gotData := x.GetAllDevices("396114142", token)
  27. str, err := json.Marshal(gotData)
  28. t.Log(string(str), err)
  29. }