adv_test.go 774 B

1234567891011121314151617181920212223242526272829303132333435
  1. package http
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. "fmt"
  6. "net/url"
  7. "strconv"
  8. "testing"
  9. "time"
  10. )
  11. func TestAdvList(t *testing.T) {
  12. params := url.Values{}
  13. params.Set("oid", "10108682")
  14. params.Set("bType", "all")
  15. params.Set("mode", "all")
  16. params.Set("appkey", "53e2fa226f5ad348")
  17. params.Set("ts", strconv.FormatInt(time.Now().Unix(), 10))
  18. mh := md5.Sum([]byte(params.Encode() + "3cf6bd1b0ff671021da5f424fea4b04a"))
  19. params.Set("sign", hex.EncodeToString(mh[:]))
  20. s := managerHost + "/x/admin/dm/adv/list?" + params.Encode()
  21. body, err := oget(s)
  22. if err != nil {
  23. t.Errorf("url(%s) error(%s)", s, err)
  24. t.FailNow()
  25. }
  26. if err = ccode(body); err != nil {
  27. t.Fatal(err, string(body))
  28. t.FailNow()
  29. }
  30. t.Logf("=========%v\n", body)
  31. fmt.Println(string(body))
  32. }