-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocument_test.go
34 lines (29 loc) · 922 Bytes
/
document_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package telebot
import (
"github.com/stretchr/testify/require"
"testing"
)
func Test_Online_SendDocument(t *testing.T) {
DocumentFileFromURL := FromURL("https://raw.githubusercontent.com/reloadlife/telebot/master/.github/pdffile.pdf")
DocumentFileFromFile := FromDisk("./.github/pdffile.pdf")
DocumentFileFromFile.fileName = "pdffile.pdf"
require.True(t, DocumentFileFromFile.OnDisk())
markup := NewMarkup()
markup.Inline()
markup.AddRow(NewInlineKeyboardButton("Document test", "hey"))
msg, err = tg.SendDocument(whereTo, DocumentFileFromURL,
"__Document__ `File Test`",
ParseModeMarkdownV2,
markup,
Silent,
Protected,
&thumb,
)
require.NoError(t, err)
require.NotNil(t, msg)
require.Equal(t, msg.Chat.ID, intChatID)
require.Equal(t, *msg.Caption, "Document File Test")
require.Panics(t, func() {
_, _ = tg.SendDocument(whereTo, DocumentFileFromURL, "Some Caption!", false, true)
})
}