選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

72 行
1.8KB

  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. }
  15. func TestSendPic(t *testing.T) {
  16. SetupConfig()
  17. kfSendPic(toUser, "media_for_test/200x200.png")
  18. }
  19. func TestSendVoice(t *testing.T) {
  20. SetupConfig()
  21. kfSendVoice(toUser, "media_for_test/example.amr")
  22. //kfSendVoiceByMediaID(toUser, "8Tc-pcFxEMtbO6T71AaL0A16taJUpwolXpB06mBBfaPZ68R3__1nN7HuZAUyW8xR")
  23. }
  24. func TestSendVideo(t *testing.T) {
  25. SetupConfig()
  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. SetupConfig()
  35. tID := uploadThumb("media_for_test/music-thumb.jpg")
  36. description := fmt.Sprintf("音乐描述 %s", time.Now().String())
  37. kfSendMusic(toUser,
  38. "音乐标题",
  39. description,
  40. tID,
  41. "https://biukop.com.au/music.mp3",
  42. "https://biukop.com.au/music.mp3")
  43. }
  44. func TestSendArticle(t *testing.T) {
  45. SetupConfig()
  46. articles := []sendNewsArticle{}
  47. for i := 1; i <= 8; i++ {
  48. a := sendNewsArticle{}
  49. a.Description = fmt.Sprintf("描述 %d ", i)
  50. a.PicURL = "https://placehold.it/360x200.jpg"
  51. a.Title = fmt.Sprintf("标题 %d", i)
  52. a.URL = fmt.Sprintf("https://placehold.it/%dx%d", i*100, i*100)
  53. articles = append(articles, a)
  54. }
  55. kfSendNews(toUser, "总标题", "总描述", articles)
  56. }
  57. func TestSendArticleByMediaID(t *testing.T) {
  58. SetupConfig()
  59. kfSendMPNews(toUser, "e2iNEiSxCX5TV1WbFd0TQP4_MKtjcY1q-4UPIZFrHhw")
  60. }