@@ -92,7 +92,7 @@ func TestSendWithMessageForward(t *testing.T) {
92
92
func TestSendWithNewPhoto (t * testing.T ) {
93
93
bot , _ := getBot (t )
94
94
95
- msg := NewPhotoUpload (ChatID , "tests/image.jpg" )
95
+ msg := NewPhoto (ChatID , "tests/image.jpg" )
96
96
msg .Caption = "Test"
97
97
_ , err := bot .Send (msg )
98
98
@@ -107,7 +107,7 @@ func TestSendWithNewPhotoWithFileBytes(t *testing.T) {
107
107
data , _ := ioutil .ReadFile ("tests/image.jpg" )
108
108
b := FileBytes {Name : "image.jpg" , Bytes : data }
109
109
110
- msg := NewPhotoUpload (ChatID , b )
110
+ msg := NewPhoto (ChatID , b )
111
111
msg .Caption = "Test"
112
112
_ , err := bot .Send (msg )
113
113
@@ -122,7 +122,7 @@ func TestSendWithNewPhotoWithFileReader(t *testing.T) {
122
122
f , _ := os .Open ("tests/image.jpg" )
123
123
reader := FileReader {Name : "image.jpg" , Reader : f , Size : - 1 }
124
124
125
- msg := NewPhotoUpload (ChatID , reader )
125
+ msg := NewPhoto (ChatID , reader )
126
126
msg .Caption = "Test"
127
127
_ , err := bot .Send (msg )
128
128
@@ -134,7 +134,7 @@ func TestSendWithNewPhotoWithFileReader(t *testing.T) {
134
134
func TestSendWithNewPhotoReply (t * testing.T ) {
135
135
bot , _ := getBot (t )
136
136
137
- msg := NewPhotoUpload (ChatID , "tests/image.jpg" )
137
+ msg := NewPhoto (ChatID , "tests/image.jpg" )
138
138
msg .ReplyToMessageID = ReplyToMessageID
139
139
140
140
_ , err := bot .Send (msg )
@@ -147,7 +147,7 @@ func TestSendWithNewPhotoReply(t *testing.T) {
147
147
func TestSendNewPhotoToChannel (t * testing.T ) {
148
148
bot , _ := getBot (t )
149
149
150
- msg := NewPhotoUploadToChannel (Channel , "tests/image.jpg" )
150
+ msg := NewPhotoToChannel (Channel , "tests/image.jpg" )
151
151
msg .Caption = "Test"
152
152
_ , err := bot .Send (msg )
153
153
@@ -163,7 +163,7 @@ func TestSendNewPhotoToChannelFileBytes(t *testing.T) {
163
163
data , _ := ioutil .ReadFile ("tests/image.jpg" )
164
164
b := FileBytes {Name : "image.jpg" , Bytes : data }
165
165
166
- msg := NewPhotoUploadToChannel (Channel , b )
166
+ msg := NewPhotoToChannel (Channel , b )
167
167
msg .Caption = "Test"
168
168
_ , err := bot .Send (msg )
169
169
@@ -179,7 +179,7 @@ func TestSendNewPhotoToChannelFileReader(t *testing.T) {
179
179
f , _ := os .Open ("tests/image.jpg" )
180
180
reader := FileReader {Name : "image.jpg" , Reader : f , Size : - 1 }
181
181
182
- msg := NewPhotoUploadToChannel (Channel , reader )
182
+ msg := NewPhotoToChannel (Channel , reader )
183
183
msg .Caption = "Test"
184
184
_ , err := bot .Send (msg )
185
185
@@ -192,7 +192,7 @@ func TestSendNewPhotoToChannelFileReader(t *testing.T) {
192
192
func TestSendWithExistingPhoto (t * testing.T ) {
193
193
bot , _ := getBot (t )
194
194
195
- msg := NewPhotoShare (ChatID , ExistingPhotoFileID )
195
+ msg := NewPhoto (ChatID , FileID ( ExistingPhotoFileID ) )
196
196
msg .Caption = "Test"
197
197
_ , err := bot .Send (msg )
198
198
@@ -204,7 +204,19 @@ func TestSendWithExistingPhoto(t *testing.T) {
204
204
func TestSendWithNewDocument (t * testing.T ) {
205
205
bot , _ := getBot (t )
206
206
207
- msg := NewDocumentUpload (ChatID , "tests/image.jpg" )
207
+ msg := NewDocument (ChatID , "tests/image.jpg" )
208
+ _ , err := bot .Send (msg )
209
+
210
+ if err != nil {
211
+ t .Error (err )
212
+ }
213
+ }
214
+
215
+ func TestSendWithNewDocumentAndThumb (t * testing.T ) {
216
+ bot , _ := getBot (t )
217
+
218
+ msg := NewDocument (ChatID , "tests/voice.ogg" )
219
+ msg .AddFile ("thumb" , "tests/image.jpg" )
208
220
_ , err := bot .Send (msg )
209
221
210
222
if err != nil {
@@ -215,7 +227,7 @@ func TestSendWithNewDocument(t *testing.T) {
215
227
func TestSendWithExistingDocument (t * testing.T ) {
216
228
bot , _ := getBot (t )
217
229
218
- msg := NewDocumentShare (ChatID , ExistingDocumentFileID )
230
+ msg := NewDocument (ChatID , FileID ( ExistingDocumentFileID ) )
219
231
_ , err := bot .Send (msg )
220
232
221
233
if err != nil {
@@ -226,7 +238,7 @@ func TestSendWithExistingDocument(t *testing.T) {
226
238
func TestSendWithNewAudio (t * testing.T ) {
227
239
bot , _ := getBot (t )
228
240
229
- msg := NewAudioUpload (ChatID , "tests/audio.mp3" )
241
+ msg := NewAudio (ChatID , "tests/audio.mp3" )
230
242
msg .Title = "TEST"
231
243
msg .Duration = 10
232
244
msg .Performer = "TEST"
@@ -242,7 +254,7 @@ func TestSendWithNewAudio(t *testing.T) {
242
254
func TestSendWithExistingAudio (t * testing.T ) {
243
255
bot , _ := getBot (t )
244
256
245
- msg := NewAudioShare (ChatID , ExistingAudioFileID )
257
+ msg := NewAudio (ChatID , FileID ( ExistingAudioFileID ) )
246
258
msg .Title = "TEST"
247
259
msg .Duration = 10
248
260
msg .Performer = "TEST"
@@ -257,7 +269,7 @@ func TestSendWithExistingAudio(t *testing.T) {
257
269
func TestSendWithNewVoice (t * testing.T ) {
258
270
bot , _ := getBot (t )
259
271
260
- msg := NewVoiceUpload (ChatID , "tests/voice.ogg" )
272
+ msg := NewVoice (ChatID , "tests/voice.ogg" )
261
273
msg .Duration = 10
262
274
_ , err := bot .Send (msg )
263
275
@@ -269,7 +281,7 @@ func TestSendWithNewVoice(t *testing.T) {
269
281
func TestSendWithExistingVoice (t * testing.T ) {
270
282
bot , _ := getBot (t )
271
283
272
- msg := NewVoiceShare (ChatID , ExistingVoiceFileID )
284
+ msg := NewVoice (ChatID , FileID ( ExistingVoiceFileID ) )
273
285
msg .Duration = 10
274
286
_ , err := bot .Send (msg )
275
287
@@ -311,7 +323,7 @@ func TestSendWithVenue(t *testing.T) {
311
323
func TestSendWithNewVideo (t * testing.T ) {
312
324
bot , _ := getBot (t )
313
325
314
- msg := NewVideoUpload (ChatID , "tests/video.mp4" )
326
+ msg := NewVideo (ChatID , "tests/video.mp4" )
315
327
msg .Duration = 10
316
328
msg .Caption = "TEST"
317
329
@@ -325,7 +337,7 @@ func TestSendWithNewVideo(t *testing.T) {
325
337
func TestSendWithExistingVideo (t * testing.T ) {
326
338
bot , _ := getBot (t )
327
339
328
- msg := NewVideoShare (ChatID , ExistingVideoFileID )
340
+ msg := NewVideo (ChatID , FileID ( ExistingVideoFileID ) )
329
341
msg .Duration = 10
330
342
msg .Caption = "TEST"
331
343
@@ -339,7 +351,7 @@ func TestSendWithExistingVideo(t *testing.T) {
339
351
func TestSendWithNewVideoNote (t * testing.T ) {
340
352
bot , _ := getBot (t )
341
353
342
- msg := NewVideoNoteUpload (ChatID , 240 , "tests/videonote.mp4" )
354
+ msg := NewVideoNote (ChatID , 240 , "tests/videonote.mp4" )
343
355
msg .Duration = 10
344
356
345
357
_ , err := bot .Send (msg )
@@ -352,7 +364,7 @@ func TestSendWithNewVideoNote(t *testing.T) {
352
364
func TestSendWithExistingVideoNote (t * testing.T ) {
353
365
bot , _ := getBot (t )
354
366
355
- msg := NewVideoNoteShare (ChatID , 240 , ExistingVideoNoteFileID )
367
+ msg := NewVideoNote (ChatID , 240 , FileID ( ExistingVideoNoteFileID ) )
356
368
msg .Duration = 10
357
369
358
370
_ , err := bot .Send (msg )
@@ -365,7 +377,7 @@ func TestSendWithExistingVideoNote(t *testing.T) {
365
377
func TestSendWithNewSticker (t * testing.T ) {
366
378
bot , _ := getBot (t )
367
379
368
- msg := NewStickerUpload (ChatID , "tests/image.jpg" )
380
+ msg := NewSticker (ChatID , "tests/image.jpg" )
369
381
370
382
_ , err := bot .Send (msg )
371
383
@@ -377,7 +389,7 @@ func TestSendWithNewSticker(t *testing.T) {
377
389
func TestSendWithExistingSticker (t * testing.T ) {
378
390
bot , _ := getBot (t )
379
391
380
- msg := NewStickerShare (ChatID , ExistingStickerFileID )
392
+ msg := NewSticker (ChatID , FileID ( ExistingStickerFileID ) )
381
393
382
394
_ , err := bot .Send (msg )
383
395
@@ -389,7 +401,7 @@ func TestSendWithExistingSticker(t *testing.T) {
389
401
func TestSendWithNewStickerAndKeyboardHide (t * testing.T ) {
390
402
bot , _ := getBot (t )
391
403
392
- msg := NewStickerUpload (ChatID , "tests/image.jpg" )
404
+ msg := NewSticker (ChatID , "tests/image.jpg" )
393
405
msg .ReplyMarkup = ReplyKeyboardRemove {
394
406
RemoveKeyboard : true ,
395
407
Selective : false ,
@@ -404,7 +416,7 @@ func TestSendWithNewStickerAndKeyboardHide(t *testing.T) {
404
416
func TestSendWithExistingStickerAndKeyboardHide (t * testing.T ) {
405
417
bot , _ := getBot (t )
406
418
407
- msg := NewStickerShare (ChatID , ExistingStickerFileID )
419
+ msg := NewSticker (ChatID , FileID ( ExistingStickerFileID ) )
408
420
msg .ReplyMarkup = ReplyKeyboardRemove {
409
421
RemoveKeyboard : true ,
410
422
Selective : false ,
@@ -526,9 +538,9 @@ func TestSendWithMediaGroup(t *testing.T) {
526
538
bot , _ := getBot (t )
527
539
528
540
cfg := NewMediaGroup (ChatID , []interface {}{
529
- NewInputMediaPhoto ("https://i.imgur.com/unQLJIb.jpg" ),
530
- NewInputMediaPhoto ("https://i.imgur.com/J5qweNZ .jpg" ),
531
- NewInputMediaVideo ("https://i.imgur.com/F6RmI24 .mp4" ),
541
+ NewInputMediaPhoto (FileURL ( "https://i.imgur.com/unQLJIb.jpg" ) ),
542
+ NewInputMediaPhoto ("tests/image .jpg" ),
543
+ NewInputMediaVideo ("tests/video .mp4" ),
532
544
})
533
545
534
546
messages , err := bot .SendMediaGroup (cfg )
@@ -537,11 +549,11 @@ func TestSendWithMediaGroup(t *testing.T) {
537
549
}
538
550
539
551
if messages == nil {
540
- t .Error ()
552
+ t .Error ("No received messages" )
541
553
}
542
554
543
- if len (messages ) != 3 {
544
- t .Error ( )
555
+ if len (messages ) != len ( cfg . Media ) {
556
+ t .Errorf ( "Different number of messages: %d" , len ( messages ) )
545
557
}
546
558
}
547
559
0 commit comments