您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

77 行
2.0KB

  1. package main
  2. import (
  3. "fmt"
  4. "testing"
  5. "time"
  6. )
  7. var toUser = "oUN420Wj78vnkNeAJY7RMPXA28oc" // "oUN420bxqFqlx0ZQHciUOesZO3PE"
  8. func TestSendTxt(t *testing.T) {
  9. msg := fmt.Sprintf("测试消息 & < >, %s ", time.Now().String())
  10. // randinit()
  11. // msg = RandStringRunes(2048)
  12. //kfSendTxt(toUser, msg)
  13. kfSendTxtAs(toUser, msg, "孙鹏")
  14. kfSendTxtAs(toUser, msg, "理事")
  15. kfSendTxtAs(toUser, msg, "不存在的用户")
  16. //kfSendTxtAs(toUser, msg, "kf2002@gh_f09231355c68")
  17. }
  18. func TestSendPic(t *testing.T) {
  19. kfSendPic(toUser, "media_for_test/200x200.png")
  20. }
  21. func TestSendVoice(t *testing.T) {
  22. kfSendVoice(toUser, "media_for_test/example.amr")
  23. //kfSendVoiceByMediaID(toUser, "8Tc-pcFxEMtbO6T71AaL0A16taJUpwolXpB06mBBfaPZ68R3__1nN7HuZAUyW8xR")
  24. }
  25. func TestSendVideo(t *testing.T) {
  26. kfSendVideo(toUser, "media_for_test/video.mp4", "测试时品", "普通描述", "media_for_test/music-thumb.jpg")
  27. // kfSendVideoByMediaID(toUser,
  28. // "xwcgPCY8TRHP_PIy_4qunL8ad9mq7vD3hc9-OpNVRKG1qTwjKkQHN4GKb9mAcJ3J",
  29. // "视频测试标题",
  30. // "视频测试描述信息",
  31. // "6QKTfDxkQS2ACDzVhY0ddKjlIsBTyB6cf9fFWG88uwbJ0Mlh_gSIMxnaGvdqU4y0")
  32. }
  33. func TestSendMusic(t *testing.T) {
  34. tID := uploadThumb("media_for_test/music-thumb.jpg")
  35. description := fmt.Sprintf("音乐描述 %s", time.Now().String())
  36. kfSendMusic(toUser,
  37. "音乐标题",
  38. description,
  39. tID,
  40. "https://biukop.com.au/music.mp3",
  41. "https://biukop.com.au/music.mp3")
  42. }
  43. func TestSendArticle(t *testing.T) {
  44. articles := []sendNewsArticle{}
  45. for i := 1; i <= 8; i++ {
  46. a := sendNewsArticle{}
  47. a.Description = fmt.Sprintf("描述 %d ", i)
  48. a.PicURL = "https://placehold.it/360x200.jpg"
  49. a.Title = fmt.Sprintf("标题 %d", i)
  50. a.URL = fmt.Sprintf("https://placehold.it/%dx%d", i*100, i*100)
  51. articles = append(articles, a)
  52. }
  53. kfSendNews(toUser, "总标题", "总描述", articles)
  54. }
  55. func TestSendArticleByMediaID(t *testing.T) {
  56. kfSendMPNews(toUser, "e2iNEiSxCX5TV1WbFd0TQP4_MKtjcY1q-4UPIZFrHhw")
  57. }