Fix all tests.
This commit is contained in:
parent
40e1c9b680
commit
5e497cfcba
1 changed files with 55 additions and 47 deletions
|
@ -137,15 +137,18 @@ func TestSendWithNewPhoto(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
|
func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, err := getBot(t)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
data, _ := os.ReadFile("./image.jpg")
|
data, err := os.ReadFile("./image.jpg")
|
||||||
|
require.NoError(t, err)
|
||||||
b := tgbotapi.FileBytes{Name: "image.jpg", Bytes: data}
|
b := tgbotapi.FileBytes{Name: "image.jpg", Bytes: data}
|
||||||
|
|
||||||
msg := tgbotapi.NewPhoto(ChatID, b)
|
msg := tgbotapi.NewPhoto(ChatID, b)
|
||||||
msg.Caption = "Test"
|
msg.Caption = "Test"
|
||||||
_, err := bot.Send(msg)
|
m, err := bot.Send(msg)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
require.NotNil(t, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSendWithNewPhotoWithFileReader(t *testing.T) {
|
func TestSendWithNewPhotoWithFileReader(t *testing.T) {
|
||||||
|
@ -501,34 +504,38 @@ func TestSendWithDiceWithEmoji(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSendChatConfig(t *testing.T) {
|
func TestSendChatConfig(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, err := getBot(t)
|
||||||
|
|
||||||
_, err := bot.Request(tgbotapi.NewChatAction(ChatID, tgbotapi.ChatTyping))
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
m, err := bot.Request(tgbotapi.NewChatAction(ChatID, tgbotapi.ChatTyping))
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NotNil(t, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: identify why this isn't working
|
func TestSendEditMessage(t *testing.T) {
|
||||||
// func TestSendEditMessage(t *testing.T) {
|
bot, err := getBot(t)
|
||||||
// bot, _ := getBot(t)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// msg, err := bot.Send(NewMessage(ChatID, "Testing editing."))
|
msg, err := bot.Send(tgbotapi.NewMessage(ChatID, "Testing editing."))
|
||||||
// if err != nil {
|
require.NoError(t, err)
|
||||||
// t.Error(err)
|
require.NotNil(t, msg)
|
||||||
// }
|
|
||||||
|
|
||||||
// edit := EditMessageTextConfig{
|
edit := tgbotapi.EditMessageTextConfig{
|
||||||
// BaseEdit: BaseEdit{
|
BaseEdit: tgbotapi.BaseEdit{
|
||||||
// ChatID: ChatID,
|
BaseChatMessage: tgbotapi.BaseChatMessage{
|
||||||
// MessageID: msg.MessageID,
|
MessageID: msg.MessageID,
|
||||||
// },
|
ChatConfig: tgbotapi.ChatConfig{
|
||||||
// Text: "Updated text.",
|
ChatID: ChatID,
|
||||||
// }
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Text: "Updated text.",
|
||||||
|
}
|
||||||
|
|
||||||
// _, err = bot.Send(edit)
|
m, err := bot.Send(edit)
|
||||||
// if err != nil {
|
require.NoError(t, err)
|
||||||
// t.Error(err)
|
require.NotNil(t, m)
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
func TestGetUserProfilePhotos(t *testing.T) {
|
func TestGetUserProfilePhotos(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, _ := getBot(t)
|
||||||
|
@ -839,28 +846,29 @@ func TestCommands(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: figure out why test is failing
|
// TODO: figure out why test is failing
|
||||||
//
|
func TestEditMessageMedia(t *testing.T) {
|
||||||
// func TestEditMessageMedia(t *testing.T) {
|
bot, err := getBot(t)
|
||||||
// bot, _ := getBot(t)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// msg := NewPhoto(ChatID, "./image.jpg")
|
msg := tgbotapi.NewPhoto(ChatID, tgbotapi.FilePath("./image.jpg"))
|
||||||
// msg.Caption = "Test"
|
msg.Caption = "Test"
|
||||||
// m, err := bot.Send(msg)
|
m, err := bot.Send(msg)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NotNil(t, m)
|
||||||
|
|
||||||
// if err != nil {
|
edit := tgbotapi.EditMessageMediaConfig{
|
||||||
// t.Error(err)
|
BaseEdit: tgbotapi.BaseEdit{
|
||||||
// }
|
BaseChatMessage: tgbotapi.BaseChatMessage{
|
||||||
|
MessageID: m.MessageID,
|
||||||
|
ChatConfig: tgbotapi.ChatConfig{
|
||||||
|
ChatID: ChatID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Media: tgbotapi.NewInputMediaVideo(tgbotapi.FilePath("./video.mp4")),
|
||||||
|
}
|
||||||
|
|
||||||
// edit := EditMessageMediaConfig{
|
res, err := bot.Request(edit)
|
||||||
// BaseEdit: BaseEdit{
|
require.NoError(t, err)
|
||||||
// ChatID: ChatID,
|
require.NotNil(t, res)
|
||||||
// MessageID: m.MessageID,
|
}
|
||||||
// },
|
|
||||||
// Media: NewInputMediaVideo(FilePath("./video.mp4")),
|
|
||||||
// }
|
|
||||||
|
|
||||||
// _, err = bot.Request(edit)
|
|
||||||
// if err != nil {
|
|
||||||
// t.Error(err)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue