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.

75 líneas
1.9KB

  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, "kf2002@gh_f09231355c68")
  16. }
  17. func TestSendPic(t *testing.T) {
  18. SetupConfig()
  19. kfSendPic(toUser, "media_for_test/200x200.png")
  20. }
  21. func TestSendVoice(t *testing.T) {
  22. SetupConfig()
  23. kfSendVoice(toUser, "media_for_test/example.amr")
  24. //kfSendVoiceByMediaID(toUser, "8Tc-pcFxEMtbO6T71AaL0A16taJUpwolXpB06mBBfaPZ68R3__1nN7HuZAUyW8xR")
  25. }
  26. func TestSendVideo(t *testing.T) {
  27. SetupConfig()
  28. kfSendVideo(toUser, "media_for_test/video.mp4", "测试时品", "普通描述", "media_for_test/music-thumb.jpg")
  29. // kfSendVideoByMediaID(toUser,
  30. // "xwcgPCY8TRHP_PIy_4qunL8ad9mq7vD3hc9-OpNVRKG1qTwjKkQHN4GKb9mAcJ3J",
  31. // "视频测试标题",
  32. // "视频测试描述信息",
  33. // "6QKTfDxkQS2ACDzVhY0ddKjlIsBTyB6cf9fFWG88uwbJ0Mlh_gSIMxnaGvdqU4y0")
  34. }
  35. func TestSendMusic(t *testing.T) {
  36. SetupConfig()
  37. tID := uploadThumb("media_for_test/music-thumb.jpg")
  38. description := fmt.Sprintf("音乐描述 %s", time.Now().String())
  39. kfSendMusic(toUser,
  40. "音乐标题",
  41. description,
  42. tID,
  43. "https://biukop.com.au/music.mp3",
  44. "https://biukop.com.au/music.mp3")
  45. }
  46. func TestSendArticle(t *testing.T) {
  47. SetupConfig()
  48. articles := []sendNewsArticle{}
  49. for i := 1; i <= 8; i++ {
  50. a := sendNewsArticle{}
  51. a.Description = fmt.Sprintf("描述 %d ", i)
  52. a.PicURL = "https://placehold.it/360x200.jpg"
  53. a.Title = fmt.Sprintf("标题 %d", i)
  54. a.URL = fmt.Sprintf("https://placehold.it/%dx%d", i*100, i*100)
  55. articles = append(articles, a)
  56. }
  57. kfSendNews(toUser, "总标题", "总描述", articles)
  58. }
  59. func TestSendArticleByMediaID(t *testing.T) {
  60. SetupConfig()
  61. kfSendMPNews(toUser, "e2iNEiSxCX5TV1WbFd0TQP4_MKtjcY1q-4UPIZFrHhw")
  62. }