mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 00:27:46 +01:00
Adding sendPhoto method by file_id
This commit is contained in:
parent
f7a15306a8
commit
5e2f60ed7d
2 changed files with 10 additions and 3 deletions
|
@ -144,7 +144,7 @@ class Bot(object):
|
|||
data=None):
|
||||
|
||||
if method == 'POST':
|
||||
if data.has_key('photo'):
|
||||
if data.has_key('photo') and isinstance(data['photo'], file):
|
||||
try:
|
||||
photo = data.pop('photo')
|
||||
|
||||
|
|
|
@ -46,7 +46,14 @@ class BotTest(unittest.TestCase):
|
|||
|
||||
def testSendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print 'Testing sendPhoto'
|
||||
print 'Testing sendPhoto - File'
|
||||
message = self._bot.sendPhoto(photo=open('tests/telegram.png', 'rb'),
|
||||
chat_id=12173560)
|
||||
#self.assertEqual(u'')
|
||||
self.assertEqual(12948, message.photo[2].get('file_size'))
|
||||
|
||||
def testReSendPhoto(self):
|
||||
'''Test the telegram.Bot sendPhoto method'''
|
||||
print 'Testing sendPhoto - Resend'
|
||||
message = self._bot.sendPhoto(photo=str('AgAD_v___6-nMRs1PC0HuqtHTCQ9qx0AFAI'),
|
||||
chat_id=12173560)
|
||||
self.assertEqual(u'AgAD_v___6-nMRs1PC0HuqtHTCQ9qx0AFAI', message.photo[2].get('file_id'))
|
||||
|
|
Loading…
Reference in a new issue