mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-02-16 18:31:45 +01:00
use timed tests and flaky
This commit is contained in:
parent
e189e8ad05
commit
d05fa1275a
8 changed files with 135 additions and 0 deletions
|
@ -3,3 +3,4 @@ nose
|
|||
pep257
|
||||
pylint
|
||||
unittest2
|
||||
flaky
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -50,6 +53,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_required_args_only(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - With required arguments only')
|
||||
|
@ -67,6 +72,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.mime_type, self.mime_type)
|
||||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - With all arguments')
|
||||
|
@ -89,6 +96,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.mime_type, self.mime_type)
|
||||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_mp3_file(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File')
|
||||
|
@ -109,6 +118,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.mime_type, self.mime_type)
|
||||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_mp3_file_custom_filename(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File with custom filename')
|
||||
|
@ -130,6 +141,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.mime_type, self.mime_type)
|
||||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_mp3_url_file(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - MP3 File by URL')
|
||||
|
@ -150,6 +163,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio.mime_type, self.mime_type)
|
||||
self.assertEqual(audio.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_audio_resend(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendAudio - Resend by file_id')
|
||||
|
@ -203,6 +218,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(audio['mime_type'], self.mime_type)
|
||||
self.assertEqual(audio['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_audio_empty_file(self):
|
||||
print('Testing bot.sendAudio - Null file')
|
||||
|
||||
|
@ -215,6 +232,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendAudio(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_audio_empty_file_id(self):
|
||||
print('Testing bot.sendAudio - Empty file_id')
|
||||
|
||||
|
@ -227,6 +246,8 @@ class AudioTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendAudio(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_audio_without_required_args(self):
|
||||
print('Testing bot.sendAudio - Without required arguments')
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
import os
|
||||
from datetime import datetime
|
||||
import sys
|
||||
from flaky import flaky
|
||||
|
||||
if sys.version_info[0:2] == (2, 6):
|
||||
import unittest2 as unittest
|
||||
|
@ -33,11 +34,14 @@ sys.path.append('.')
|
|||
|
||||
import telegram
|
||||
from tests.base import BaseTest
|
||||
from nose.tools import timed
|
||||
|
||||
|
||||
class BotTest(BaseTest, unittest.TestCase):
|
||||
"""This object represents Tests for Telegram Bot."""
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testGetMe(self):
|
||||
'''Test the telegram.Bot getMe method'''
|
||||
print('Testing getMe')
|
||||
|
@ -50,6 +54,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(bot.username, 'PythonTelegramBot')
|
||||
self.assertEqual(bot.name, '@PythonTelegramBot')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendMessage(self):
|
||||
'''Test the telegram.Bot sendMessage method'''
|
||||
print('Testing sendMessage')
|
||||
|
@ -60,6 +66,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.text, u'Моё судно на воздушной подушке полно угрей')
|
||||
self.assertTrue(isinstance(message.date, datetime))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testGetUpdates(self):
|
||||
'''Test the telegram.Bot getUpdates method'''
|
||||
print('Testing getUpdates')
|
||||
|
@ -69,6 +77,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(self.is_json(updates[0].to_json()))
|
||||
self.assertTrue(isinstance(updates[0], telegram.Update))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testForwardMessage(self):
|
||||
'''Test the telegram.Bot forwardMessage method'''
|
||||
print('Testing forwardMessage')
|
||||
|
@ -81,6 +91,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.forward_from.username, 'leandrotoledo')
|
||||
self.assertTrue(isinstance(message.forward_date, datetime))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing sendPhoto - File')
|
||||
|
@ -92,6 +104,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(message.photo[0].file_size, 1451)
|
||||
self.assertEqual(message.caption, 'testSendPhoto')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testResendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing sendPhoto - Resend')
|
||||
|
@ -101,6 +115,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_id, 'AgADAQADyKcxGx8j9Qdp6d-gpUsw4Gja1i8ABEVJsVqQk8LfJ3wAAgI')
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendJPGURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendJPGURLPhoto - URL')
|
||||
|
@ -110,6 +126,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_size, 822)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendPNGURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendPNGURLPhoto - URL')
|
||||
|
@ -119,6 +137,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendGIFURLPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print('Testing testSendGIFURLPhoto - URL')
|
||||
|
@ -128,6 +148,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(self.is_json(message.to_json()))
|
||||
self.assertEqual(message.photo[0].file_size, 684)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testSendChatAction(self):
|
||||
'''Test the telegram.Bot sendChatAction method'''
|
||||
print('Testing sendChatAction - ChatAction.TYPING')
|
||||
|
@ -135,6 +157,8 @@ class BotTest(BaseTest, unittest.TestCase):
|
|||
self._bot.sendChatAction(action=telegram.ChatAction.TYPING,
|
||||
chat_id=self._chat_id)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def testGetUserProfilePhotos(self):
|
||||
'''Test the telegram.Bot getUserProfilePhotos method'''
|
||||
print('Testing getUserProfilePhotos')
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -51,6 +54,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_document_png_file(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - PNG File')
|
||||
|
@ -67,6 +72,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.mime_type, self.mime_type)
|
||||
self.assertEqual(document.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_document_png_file_with_custom_file_name(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - PNG File with custom filename')
|
||||
|
@ -84,6 +91,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.mime_type, self.mime_type)
|
||||
self.assertEqual(document.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_document_url_gif_file(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - GIF File by URL')
|
||||
|
@ -100,6 +109,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document.mime_type, 'image/gif')
|
||||
self.assertEqual(document.file_size, 3878)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_document_resend(self):
|
||||
"""Test telegram.Bot sendDocument method"""
|
||||
print('Testing bot.sendDocument - Resend by file_id')
|
||||
|
@ -147,6 +158,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(document['mime_type'], self.mime_type)
|
||||
self.assertEqual(document['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_document_empty_file(self):
|
||||
print('Testing bot.sendDocument - Null file')
|
||||
|
||||
|
@ -159,6 +172,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendDocument(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_document_empty_file_id(self):
|
||||
print('Testing bot.sendDocument - Empty file_id')
|
||||
|
||||
|
@ -171,6 +186,8 @@ class DocumentTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendDocument(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_document_without_required_args(self):
|
||||
print('Testing bot.sendDocument - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -53,6 +56,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_sendphotoo_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendPhoto - With all arguments')
|
||||
|
@ -79,6 +84,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
|
||||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_photo_jpg_file(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - JPG File')
|
||||
|
@ -102,6 +109,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo.height, self.height)
|
||||
self.assertEqual(photo.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_photo_url_jpg_file(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - JPG File by URL')
|
||||
|
@ -125,6 +134,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo.height, self.height)
|
||||
self.assertEqual(photo.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_photo_resend(self):
|
||||
"""Test telegram.Bot sendPhoto method"""
|
||||
print('Testing bot.sendPhoto - Resend by file_id')
|
||||
|
@ -177,6 +188,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(photo['height'], self.height)
|
||||
self.assertEqual(photo['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_photo_empty_file(self):
|
||||
print('Testing bot.sendPhoto - Null file')
|
||||
|
||||
|
@ -189,6 +202,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendPhoto(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_photo_empty_file_id(self):
|
||||
print('Testing bot.sendPhoto - Empty file_id')
|
||||
|
||||
|
@ -201,6 +216,8 @@ class PhotoTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendPhoto(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_photo_without_required_args(self):
|
||||
print('Testing bot.sendPhoto - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -49,9 +52,13 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_sticker_file(self):
|
||||
pass
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_sticker_resend(self):
|
||||
"""Test telegram.Bot sendSticker method"""
|
||||
print('Testing bot.sendSticker - Resend by file_id')
|
||||
|
@ -99,6 +106,8 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
self.assertTrue(isinstance(sticker['thumb'], telegram.PhotoSize))
|
||||
self.assertEqual(sticker['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_sticker_empty_file(self):
|
||||
print('Testing bot.sendSticker - Null file')
|
||||
|
||||
|
@ -111,6 +120,8 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendSticker(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_sticker_empty_file_id(self):
|
||||
print('Testing bot.sendSticker - Empty file_id')
|
||||
|
||||
|
@ -123,6 +134,8 @@ class StickerTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendSticker(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_sticker_without_required_args(self):
|
||||
print('Testing bot.sendSticker - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -55,6 +58,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_required_args_only(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - With required arguments only')
|
||||
|
@ -73,6 +78,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(video.mime_type, '')
|
||||
self.assertEqual(video.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendVideo - With all arguments')
|
||||
|
@ -95,6 +102,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
|
||||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_mp4_file(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File')
|
||||
|
@ -117,6 +126,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
|
||||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_mp4_file_with_custom_filename(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File with custom filename')
|
||||
|
@ -140,6 +151,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
|
||||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_mp4_file_url(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - MP4 File by URL')
|
||||
|
@ -162,6 +175,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
|
||||
self.assertEqual(message.caption, self.caption)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_video_resend(self):
|
||||
"""Test telegram.Bot sendVideo method"""
|
||||
print('Testing bot.sendVideo - Resend by file_id')
|
||||
|
@ -216,6 +231,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(video['mime_type'], self.mime_type)
|
||||
self.assertEqual(video['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_video_empty_file(self):
|
||||
print('Testing bot.sendVideo - Null file')
|
||||
|
||||
|
@ -228,6 +245,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendVideo(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_video_empty_file_id(self):
|
||||
print('Testing bot.sendVideo - Empty file_id')
|
||||
|
||||
|
@ -240,6 +259,8 @@ class VideoTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendVideo(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_video_without_required_args(self):
|
||||
print('Testing bot.sendVideo - Without required arguments')
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
import os
|
||||
import unittest
|
||||
import sys
|
||||
from nose.tools import timed
|
||||
from flaky import flaky
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
import telegram
|
||||
|
@ -46,6 +49,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
'file_size': self.file_size
|
||||
}
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_required_args_only(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - With required arguments only')
|
||||
|
@ -61,6 +66,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.mime_type, self.mime_type)
|
||||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_all_args(self):
|
||||
"""Test telegram.Bot sendAudio method"""
|
||||
print('Testing bot.sendVoice - With all arguments')
|
||||
|
@ -79,6 +86,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.mime_type, self.mime_type)
|
||||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_ogg_file(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File')
|
||||
|
@ -95,6 +104,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.mime_type, self.mime_type)
|
||||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_ogg_file_with_custom_filename(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File with custom filename')
|
||||
|
@ -112,6 +123,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.mime_type, self.mime_type)
|
||||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_ogg_url_file(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Ogg File by URL')
|
||||
|
@ -128,6 +141,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice.mime_type, self.mime_type)
|
||||
self.assertEqual(voice.file_size, self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_send_voice_resend(self):
|
||||
"""Test telegram.Bot sendVoice method"""
|
||||
print('Testing bot.sendVoice - Resend by file_id')
|
||||
|
@ -173,6 +188,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
self.assertEqual(voice['mime_type'], self.mime_type)
|
||||
self.assertEqual(voice['file_size'], self.file_size)
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_voice_empty_file(self):
|
||||
print('Testing bot.sendVoice - Null file')
|
||||
|
||||
|
@ -185,6 +202,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendVoice(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_send_voice_empty_file_id(self):
|
||||
print('Testing bot.sendVoice - Empty file_id')
|
||||
|
||||
|
@ -197,6 +216,8 @@ class VoiceTest(BaseTest, unittest.TestCase):
|
|||
lambda: self._bot.sendVoice(chat_id=self._chat_id,
|
||||
**json_dict))
|
||||
|
||||
@flaky
|
||||
@timed(10)
|
||||
def test_error_voice_without_required_args(self):
|
||||
print('Testing bot.sendVoice - Without required arguments')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue