X Tutup
Skip to content

consistent TelegramError exceptions for Bot.getMe()#136

Merged
jh0ker merged 10 commits intopython-telegram-bot:masterfrom
tsnoam:master
Jan 3, 2016
Merged

consistent TelegramError exceptions for Bot.getMe()#136
jh0ker merged 10 commits intopython-telegram-bot:masterfrom
tsnoam:master

Conversation

@tsnoam
Copy link
Copy Markdown
Member

@tsnoam tsnoam commented Dec 25, 2015

fixes #134

@rahiel
Copy link
Copy Markdown
Contributor

rahiel commented Dec 26, 2015

Looks good! Don't forget to add your name to AUTHORS.

@rahiel
Copy link
Copy Markdown
Contributor

rahiel commented Dec 26, 2015

@tsnoam the travis build is failing on _valid_token. I say we can do without that method, because Telegram will alert the user when the token is invalid anyway, no need for us to do it. Especially as it could incorrectly say a token is invalid like it did now.

@tsnoam
Copy link
Copy Markdown
Member Author

tsnoam commented Dec 26, 2015

@rahiel I added the test for a reason - in case of a not well formatted token, the error from the server will not be a json, but rather an html page (the documentation for the bot API).
Such a webpage will cause a wrong message in the TelegramError exception.
I think that what I'll do instead is fix the unitests to bypass that specific validation, and write new unitests to actually test it.

(and also I'll update the AUTHORS file)

@tsnoam
Copy link
Copy Markdown
Member Author

tsnoam commented Dec 26, 2015

changes with the new PR:

  • use functools.wrap for _try_except_req decorator
  • added self to AUTHORS
  • fixed bug in _valid_token -> thanks to unitests now working
  • fix unitests to work with token validator
  • gitignore: for files generated by unitests

@tsnoam
Copy link
Copy Markdown
Member Author

tsnoam commented Dec 26, 2015

pushed fix for python3...

@jh0ker
Copy link
Copy Markdown
Member

jh0ker commented Dec 26, 2015

Hey, it seems like the unit tests fail for Python 2.6, because there is an assert function missing, that you're not using (there is no regexp in the String you're testing for, so you could just use assertRaises).

All the other changes seem very neat, at a first glance! Thank you very much for your work :)

@jh0ker jh0ker self-assigned this Dec 29, 2015
@tsnoam tsnoam force-pushed the master branch 2 times, most recently from debabf1 to ef71de0 Compare December 31, 2015 19:38
@tsnoam
Copy link
Copy Markdown
Member Author

tsnoam commented Jan 3, 2016

@jh0ker
following our chat -

  • aligned Updater.__init__ prototype to be more consistent
  • added unitests to cover the changes as of above
  • the accidentally removed str.capitalize() on api_error exceptions is now back

jh0ker added a commit that referenced this pull request Jan 3, 2016
consistent TelegramError exceptions
@jh0ker jh0ker merged commit 3779d45 into python-telegram-bot:master Jan 3, 2016
@jh0ker
Copy link
Copy Markdown
Member

jh0ker commented Jan 3, 2016

Thank you very much, Noam! :)

@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bot.getMe() raises inconsistent exceptions

3 participants

X Tutup