No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

77 líneas
2.0KB

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