1919
2020
2121import os
22+ import sys
23+ sys .path .append ('.' )
2224import json
2325import telegram
2426import unittest
@@ -80,7 +82,7 @@ def testForwardMessage(self):
8082 def testSendPhoto (self ):
8183 '''Test the telegram.Bot sendPhoto method'''
8284 print ('Testing sendPhoto - File' )
83- message = self ._bot .sendPhoto (photo = open ('tests/telegram.png' , 'rb' ),
85+ message = self ._bot .sendPhoto (photo = open ('tests/data/ telegram.png' , 'rb' ),
8486 caption = 'testSendPhoto' ,
8587 chat_id = 12173560 )
8688 self .assertTrue (self .is_json (message .to_json ()))
@@ -122,7 +124,7 @@ def testSendGIFURLPhoto(self):
122124 def testSendAudio (self ):
123125 '''Test the telegram.Bot sendAudio method'''
124126 print ('Testing sendAudio - File' )
125- message = self ._bot .sendAudio (audio = open ('tests/telegram.mp3' , 'rb' ),
127+ message = self ._bot .sendAudio (audio = open ('tests/data/ telegram.mp3' , 'rb' ),
126128 chat_id = 12173560 ,
127129 performer = 'Leandro Toledo' ,
128130 title = 'Teste' )
@@ -144,7 +146,7 @@ def testResendAudio(self):
144146 def testSendVoice (self ):
145147 '''Test the telegram.Bot sendVoice method'''
146148 print ('Testing sendVoice - File' )
147- message = self ._bot .sendVoice (voice = open ('tests/telegram.ogg' , 'rb' ),
149+ message = self ._bot .sendVoice (voice = open ('tests/data/ telegram.ogg' , 'rb' ),
148150 chat_id = 12173560 )
149151 self .assertTrue (self .is_json (message .to_json ()))
150152 self .assertEqual (9199 , message .voice .file_size )
@@ -160,7 +162,7 @@ def testResendVoice(self):
160162 def testSendDocument (self ):
161163 '''Test the telegram.Bot sendDocument method'''
162164 print ('Testing sendDocument - File' )
163- message = self ._bot .sendDocument (document = open ('tests/telegram.png' , 'rb' ),
165+ message = self ._bot .sendDocument (document = open ('tests/data/ telegram.png' , 'rb' ),
164166 chat_id = 12173560 )
165167 self .assertTrue (self .is_json (message .to_json ()))
166168 self .assertEqual (12948 , message .document .file_size )
@@ -184,7 +186,7 @@ def testResendDocument(self):
184186 def testSendVideo (self ):
185187 '''Test the telegram.Bot sendVideo method'''
186188 print ('Testing sendVideo - File' )
187- message = self ._bot .sendVideo (video = open ('tests/telegram.mp4' , 'rb' ),
189+ message = self ._bot .sendVideo (video = open ('tests/data/ telegram.mp4' , 'rb' ),
188190 caption = 'testSendVideo' ,
189191 chat_id = 12173560 )
190192 self .assertTrue (self .is_json (message .to_json ()))
@@ -229,3 +231,5 @@ def testGetUserProfilePhotos(self):
229231 upf = self ._bot .getUserProfilePhotos (user_id = 12173560 )
230232 self .assertTrue (self .is_json (upf .to_json ()))
231233 self .assertEqual (6547 , upf .photos [0 ][0 ].file_size )
234+
235+ unittest .main ()
0 commit comments