Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

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