Commit graph

843 commits

Author SHA1 Message Date
Daniel Reed
cbfb7df643 Explicitly make Bot.full_name return a unicode object, rather than implicitly a unicode object in Python 3 and a str object on Python 2. (#1063) 2018-04-16 10:37:41 +02:00
Or Bin
712baf0c07 Added video note filter (#1067) 2018-04-14 21:53:54 +02:00
Emilio Molinari
3ccf40e8cc Make chat_id a positional argument inside shortcut methods of Chat and User classes #1048 (#1050)
* Make chat_id a positional argument #1048

* Fixed tests
2018-03-17 00:10:11 +01:00
Jannik
38e3b91a87 Filters for Category and file types (#1046)
* Added extra Filters for File Type and Category

Added extra Filters for File Type and Category, based on the provided Mime-Type

* Added tests for the new Filters

Added Tests for the Category and File Types Filters.

* Fixed Tests

Fixed the Tests from the last commit

* Little Fix

* Revert of unwanted changes

* Update filters.py

* Changed the strings

* Changed file_type to mime_type

* Fixed Tests
2018-03-16 23:41:48 +01:00
Eldinnie
e182046376 Fix in telegram.Message (#1042)
* Fix in telegram.Message

The `_parse_(html|markdown)` methods now properly return `None` on an empty `Message.text` or an empty `Message.caption`

* As per CR
2018-03-16 21:42:39 +01:00
Joscha Götzer
1530ed20e5 New filter: regex (#1028) 2018-03-15 06:59:27 +02:00
Eldinnie
698a91427a
Fix conversationhandler timeout (#1032)
* Fix conversationhandler

As found by @nmlorg and described in #1031

closes #1031

* adding another test and definitely finish conversationhandler

It seems another problem was when the job executed the timeout, it wasn;t removed from `self.conversation_timeouts` which made it still fail because job would be present in the handler dict, although it was already disabled.
This should fix it properly.
2018-03-05 12:18:40 +01:00
Noam Meltzer
a6bf456645
Updater improvements (#1018)
- Refactor bootstrap phase to be resilient for network errors
 - Retry bootstrap phase indefinitely (by default) on network errors
 - Improved logs
 - Improved unitests for polling updater

fixes #605
2018-03-02 23:11:16 +02:00
Evgen
811369d1a0 Added conversation timeout in ConversationHandler (#895) 2018-03-01 11:34:47 +02:00
Paul Larsen
b67ea7a691 CommandHandler - ignore strings in entities and "/" followed by whitespace (#1020) 2018-03-01 10:11:16 +02:00
Noam Meltzer
f6332d45a8
Improved File.download (#1019)
- File.download_as_bytearray - new method to get a d/led file as bytearray
   This is much more convenient and straight forward than using a file
   object.

 - File.download(): Now returns a meaningful return value

 - File.download*(): New and/or better unitests
2018-03-01 10:10:04 +02:00
Eldinnie
b275031a16 Add Message caption html/markdown methods (#1013)
Closes #1010
2018-02-22 17:38:54 +02:00
Eldinnie
a9a503b9c3 Increase timeouts on creation of fixtures in tests (#1015) 2018-02-22 15:13:57 +02:00
Noam Meltzer
3762792cca
Remove deprecated code (#1012)
* JobQueue: Remove deprecated prevent_autostart & put()

* Bot, Updater: Remove deprecated network_delay

* Remove deprecated Message.new_chat_member

closes #795
2018-02-22 14:17:06 +02:00
Noam Meltzer
baec1bb554 flake8 revamp
- Use pre-commit v1.2.0 flake8
 - Make sure we're running flake8 on examples and tests
 - Fix what had to be fixed
2018-02-19 12:41:38 +02:00
Noam Meltzer
746ae0caf3
Get jobs by name (#1011) 2018-02-19 10:36:40 +02:00
Jacob Bom
ebcc40ae92 More instance methods (#963)
* Bot.get_file now allows passing a file in addition to file_id

* Add .get_file() to Audio, Document, PhotoSize, Sticker, Video, VideoNote and Voice

* Add .send_*() methods to User and Chat
2018-02-18 17:49:52 +02:00
Jannik
c152d6583e Support v3.6 API (#1006)
* Added support for new field `telegram.Message.connected_message`

* Added support for new field `telegram.Message.connected_message`

* Added support for parse_mode in captions

* Added parse_mode parameter for captions in InlineQueryResult*

* Added supports_streaming parameter in telegram.Bot.send_video and telegram.InputMediaVideo
Fixed Docstrings for parse_mode in captions

* pypy3.5 unitests are now running with a new version due internal errors on travis.

closes #1005
2018-02-18 17:11:04 +02:00
Joscha Götzer
9338dc4697 Added utils.helpers.effective_message_type (#826) 2018-02-15 11:21:19 +02:00
Daniel Reed
063704c0b9 Explicitly check update.effective_chat in ConversationHandler.check_update (#959)
Fixes #927
2018-02-12 16:09:51 +02:00
Oleg
62e76f1fba bot.py: Add shortcut method reply_media_group (#994)
fixes #936
2018-02-12 15:51:18 +02:00
Joscha Götzer
f0dfdfb203 bot.py: Add shortcut methods reply_{markdown,html} (#827) 2018-02-12 15:39:46 +02:00
Eldinnie
d5c9212f2e Add two arguments to send_invoice (#986)
Telegram silently added `send_phone_number_to_provider` and `send_email_to_provider` to the send_invoice method.
2018-02-10 17:54:09 +02:00
Noam Meltzer
ddf3a1fcad
jobqueue: Thread safety fixes (#977)
- Fix JobQueue.jobs to obtain a lock on the internal queue object prior
   to iterating over it.

 - Rename JobQueue.queue to JobQueue._queue. This shouldn't be
   accessible by the user directly, but rather only with sanitized
   thread safe methods.

 - JobQueue.interval_seconds - access self.interval only once to avoid
   race conditions.

Fixes #968
2018-01-20 15:27:01 +02:00
Eldinnie
820f4e1d59 Fix user profile photo unitests (#967)
Telegram changed something again.
2018-01-09 17:56:43 +02:00
Mischa Krüger
eb67c039f1 Updater: Issue INFO log upon received signal (#951)
Fixes #946
2018-01-09 17:54:07 +02:00
Jacob Bom
2ca7ff82ef Update headers to 2018 (#962)
Also add two missing headers.
[ci skip]
2018-01-04 17:16:06 +02:00
graynk
d347c0d45e User.full_name convinience property (#949)
Fixes #943
2017-12-30 15:13:06 +02:00
Daniel Reed
5c8470e552 Store bot in PreCheckoutQuery (#953)
Fixes #937
2017-12-30 14:48:38 +02:00
Eldinnie
042d4bb2a4
add support for 3.5 api (#920)
* add support for 3.5 api

* removed "unused" import by accident

* Hardcoded values

Appearantly TG decided to change the size of a send image (again)

* test_official

* Improve coverage

* Finishing up

* spelling error

* pytest fixed tot < than 3.3 for python 3.3 support

* flake8

* rollback requirements

* as per CR

* object for provider_data

Make it possible to send an object that will be json-serialized for send_invoice + tests

* shorten error message

* using string_types
2017-12-08 22:38:59 +01:00
Jacob Bom
8df35fd53b Fix for crashes on 8.1 (#873)
* Make Commandhandler not crash on single char messages

* Bump release and update CHANGES.rst for 8.1.1

* No error on single / and test
2017-10-15 16:59:10 +02:00
Eldinnie
28680ac1d5 edited_updates also for channel_posts (#832) 2017-10-14 23:48:06 +03:00
Jannes Höke
ec9b16ac7b Fix command not recognized if it is directly followed by a newline (#869)
fixes #868
2017-10-14 21:04:02 +03:00
Eldinnie
bfad2fa1f3 support 3.4 API (#865) 2017-10-14 21:03:02 +03:00
Eldinnie
d75e0f6014 Stabilize Coverage (#846)
* test_error added

* ignore unstables for coverage
2017-09-25 20:58:10 +02:00
Eldinnie
dd20237f55 Enable appveyor (#823)
* modify tests and appveyor.yml

* modify test_meta

* Add pytest-cov to requirements

* appveyor.yaml adjustment

* another try

* oops

* skipping jobqueue tests on appveyor

appveyor is terrible at precise timings.

* adding reasons to skips

* modify test_official

* coverage trouble

* Make it look good

* appveyor.yml

* codecov flags

* oops

* update appveyor.yml

* shorten decorators

* removed redundant quotes
2017-09-14 17:54:00 +02:00
Eldinnie
4fe4eea893 only run coverage for relevant test (#818)
* fix test troubles

* another try

* testing travis build?

* trying pytestmark
2017-09-09 23:37:07 +02:00
Eldinnie
e13cd58773 Fix sticker tests (#807)
* Fix sticker tests

Added flaky, timeout and xfails to the stickerset bot method tests.

* Make sure the first stickersettest worked before modifying in test 2

* some mor changes to make the deletion more stable
2017-09-01 08:47:34 +02:00
Jannes Höke
1f5311b473 catch exceptions in error handlerfor errors that happen during polling (2) (#810)
* catch exceptions in error handlerfor errors that happen during polling

* add tests for error handlers that raise exceptions
2017-09-01 08:46:21 +02:00
Eldinnie
eae139d3e9 remove de_json() (#789)
* remove de_json()

* Remove or rename obsolete tests

* fixes according to rc
2017-09-01 08:45:22 +02:00
Jacob Bom
8cda3f7a71 Turn on branch coverage (#790)
* Run pre commit hook tests on all platforms TEMPORARILY

* Use os.system instead of subprocess.call

* Turn on branch coverage

* Let's try this then

* More testing!

* Update test_meta.py
2017-09-01 08:44:45 +02:00
Jacob Bom
d7929a8de4 Test UserProfilePhotos (#796) 2017-09-01 08:44:26 +02:00
Eldinnie
6cd0c14c02 Show what parameter/attribute is missing in test_offical (#808)
* Show what parameter/attribute is missing in test_offical

* Only run test_official on py3.6

Down from 3.5 and 3.6
2017-09-01 08:40:52 +02:00
Jeff
b6a0853896 Add Bot API 3.3 (#806)
* Bot API 3.3

* simpler helper methods (accept only custom names now)
attempt to fix circular import (not sure if its the correct way tho)
added helper methods into User object

* fix User objects in tests to contain is_bot required value

* fix User objects in tests to contain is_bot required value

* delete extra line that caused flake8 error

* fix swapped arguments
2017-09-01 08:40:05 +02:00
Noam Meltzer
16a49ec659 Remove DispatcherHandlerContinue + more unitests for dispatcher (#792)
The idea was nice, but it really complicated things for us and for the
user.
If a user wants to run more than one handler on an update, he can put
the handlers in different groups or he can have a single handler.
If a user wants to have multiple handlers in the same group which only
one of them should run on the update, he should use check_update().

Since we haven't released this code yet, there's no problem with
backward compatability.
2017-08-12 18:57:12 +03:00
Jacob Bom
5d7c6ad541 Switch to pytest + required fixes to code (#788)
Required fixes:
 - CallbackQuery is now comparable.
 - Message.effective_attachment, Message.photo,
   Message.new_chat_members, Message.new_chat_photo &
   Game.text_entitties semantic fixes - when they are not defined,
   return an empty list.
 - Docstring fix to Update class.
2017-08-12 00:58:41 +03:00
Noam Meltzer
915cd64140 Effective attachment (#766)
fixes #746
2017-08-08 00:25:19 +03:00
Ihor Polyakov
454ab050c0 Decrease number of requests in tests (#755) 2017-08-01 00:16:44 +03:00
Ihor Polyakov
6aacde189e Flow control ability in Dispatcher (#738)
fixes #666
2017-07-29 20:15:43 +03:00
Eldinnie
2ba7505eaf Fix TypeError exception in RegexHandler (#751)
fixes #750
2017-07-28 20:47:42 +03:00
Noam Meltzer
eef1238d60 Comment out unitest test_send_contact_with_contact
Caused too many "RetryAfter: Flood control exceeded" errors.

[ci skip]
2017-07-28 17:39:21 +03:00
Eldinnie
ae29620cd6 Remove duplicate test (#748) 2017-07-25 21:31:30 +03:00
Eldinnie
8d1d38cc4c send_* now accepts tg-objects (#742)
Fixes #731
2017-07-25 01:35:22 +03:00
Noam Meltzer
f0638df390 Disable webhook unitests
Telegram servers don't like the endless game of set/delete webhooks and
refusing our requests. We're better of without testing it.
2017-07-25 00:23:11 +03:00
Eldinnie
b3b94240a5 Docs update (#728)
Amazing new documentation.
2017-07-23 23:33:08 +03:00
Rahiel Kasim
19ce9e4512 Delete deprecated code (#693)
* remove Botan import from utils

* remove telegram.Emoji

* remove ReplyKeyboardHide

* remove edit_message argument of bot.set_game_score
2017-07-23 22:58:20 +03:00
Jelle Besseling
8320227b2a ConvesationHandler - check if a user exist before using it (#699)
Fixes #695
2017-07-23 22:29:52 +03:00
Ihor Polyakov
08d298eb60 TelegramObject.de_json became classmethod (#737)
Fixes #734
2017-07-23 22:14:38 +03:00
Jacob Bom
5a37af6f89 Bot api 3.2 (#732)
NOTE: Currently not testing StickerSet in terms of bot methods (interaction with telegrams servers) as there's no delete operations.
2017-07-22 14:34:51 +03:00
Jacob Bom
94ed4cb38d Bot api 3.1 (#698) + minor improvements
- Added all the new and shiny features from API 3.1.
 - Not API 3.1 changes:
   - Use future.utils.string_types for string isinstance checks.
   - Stall between retries of test_set_webhook_get_webhook_info() &
     test_delete_webhook().
2017-07-01 18:08:45 +03:00
Eldinnie
b4b0eb4686 Tests files from website (#687)
Use website for send from url tests instead of github.
2017-06-23 21:10:43 +03:00
Noam Meltzer
8703ae0b8d Merge pull request #683 from python-telegram-bot/no_hardcoded_fileids
No hardcoded fileids
2017-06-23 00:47:13 +03:00
Noam Meltzer
d216b83728 Merge pull request #685 from python-telegram-bot/cache-pip-ci
Cache pip for travis and appveyor + update to travis trusty container
2017-06-22 21:48:00 +03:00
Noam Meltzer
56949bcad6 Merge pull request #674 from python-telegram-bot/restructure-internal
Move a lot of files
2017-06-22 21:26:47 +03:00
Noam Meltzer
470ee86497 Merge pull request #677 from evgfilim1/new-filters
New filters for handling messages from specific chat/user id
2017-06-22 21:25:39 +03:00
Jacob Bom
5b9bb904c2 Skip "official" tests on pypy
inspect.signature() seems to return a string instead of an actual signature on pypy
2017-06-22 20:18:31 +02:00
Eldin
cedc38dcdf finalising
* Added telegram.jpg to gitignore since we're downloading it now
* moved download tests to the right tests to make test_file file_id free
2017-06-22 18:29:21 +02:00
Eldin
ac0793caa2 test_sticker modified
* cleanup assertions in test_video
* modify test_sticker to same standard as the others.
2017-06-22 18:04:19 +02:00
Eldin
28836b7735 stickerfile added 2017-06-22 17:45:06 +02:00
Eldin
4fad382f26 standardize assertions 2017-06-22 17:17:40 +02:00
Jacob Bom
512ca2643f Fix weird import in phototest 2017-06-22 15:40:43 +02:00
evgfilim1
ecfcc69cf9 Fixed tests 2017-06-22 15:20:11 +05:00
Noam Meltzer
4b3b0cb4cd Merge pull request #668 from python-telegram-bot/official-test
Add an "official test"
2017-06-21 23:14:10 +03:00
Eldin
85e52f1930 delete test file 2017-06-21 19:02:36 +02:00
Eldin
976ad1b987 new shorter audiofile 2017-06-21 19:01:20 +02:00
Eldin
1f9f3ae8a1 shorter mp3 file 2017-06-21 18:55:59 +02:00
Eldin
d2f89382a0 sending from web stuff
* Audiofile sent from web is shorter then from local
* web-photo's send more than two imagesizes
2017-06-21 18:46:50 +02:00
Eldin
b49431931a Reworked get_bot
It now decides wich bot to give depending on CI, and made ready or more bot's per version.
2017-06-21 18:25:04 +02:00
Eldin
fca64f5fc6 Move photo tests from test_bot to test_photo 2017-06-21 18:10:00 +02:00
Eldin
c92ebc4046 test_audio done
* Changed to new method of non-static file_id
* removed obsolete tests.
* changed some tests in all file
2017-06-21 17:59:35 +02:00
Eldin
281bd67298 test_document done
* Changed to new method of non-static file_id
* removed obsolete tests.
2017-06-21 17:38:20 +02:00
Eldin
f6a98d7888 test_photo done
* Changed to new method of non-static file_id
* removed obsolete tests.
2017-06-21 17:21:18 +02:00
Eldin
e7b839b69e Simple assertions in setUpClass
Py2 does not implement TestCase's assertions until setUp() is done. Hence we need simple assertions in the setUpClass
2017-06-21 16:50:40 +02:00
Eldin
4fe805ee0c Clean up after conversation
Clean setUpClass + add assertions
remove obsolete tests
add test_expected_values
2017-06-21 16:09:51 +02:00
Eldin
4bf63d7358 reformat code 2017-06-21 00:34:46 +02:00
Eldin
991ee2bc88 sys.path why? 2017-06-21 00:33:23 +02:00
Eldin
c91ffc122a test_videonote done
* Changed to new method of non-static file_id
* removed obsolete tests.
2017-06-21 00:31:14 +02:00
Eldin
7b7c4a81bb test_voice done
* Changed to new method of non-static file_id
* removed obsolete tests.
2017-06-21 00:22:11 +02:00
Eldin
6b7ce7b8f0 test_video done
* Changed to new method of non-static file_id
* removed obsolete tests.
2017-06-21 00:12:26 +02:00
Eldin
8a89265c2d first tries 2017-06-20 23:55:35 +02:00
Jacob Bom
9f1b63b165 Add module name to tests name
So they fit in with the rest better
2017-06-20 21:49:16 +02:00
Jacob Bom
0afe83ac30 Merge branch 'master' into official-test 2017-06-20 21:42:33 +02:00
evgfilim1
3bf4399a4f Fixed tests 2017-06-20 12:49:01 +05:00
Jacob Bom
dba4739f76 Add a tiny test for unnamed filters
Increases coverage by 1 (one) line! Woo :D
2017-06-19 21:49:42 +02:00
evgfilim1
e18ebd035c Added tests 2017-06-19 22:53:44 +05:00
Jacob Bom
01f3d88788 Update filter test 2017-06-18 16:25:48 +02:00
Jacob Bom
faddb92395 Clean up Bot code a bit (#673)
* Clean up Bot code a bit

- Move decorators to module. It really wasn't clear how decorators inside classes work, and why they didn't have a self parameter, but still wasn't static. This also makes them effectively private without having to underscore them, which I think we should have done long time ago atm. Note that this might break backwards compatibility slightly (only if people are daft enough to have used the decorators themselves)
- Don't call _message_wrapper directly. Ever. Instead always use the message decorator, since it's what it's there for. Closes #627
- Don't use the message decorator if the method isn't supposed to return a message. The decorator could handle values like True (which is often the return value), but to someone reading the code, it seems like it's a message returning method even when it wasn't.
- Always document timeout and **kwargs
- Log all methods

* Add test to make sure timeout propagates properly despite decorators
2017-06-18 12:14:24 +02:00
Jacob Bom
3ca6f6aa0e Add official test
Cross references method and class signatures with official docs
2017-06-14 13:42:57 +02:00
saschalalala
3863b4f371 Rename shortcut functions to snake_case (#661)
* Rename shortcut functions to snake_case

* More function renaming

* Example function rewrite

* Add myself to authors.rst

* More function renaming

* Rename mockbot test functions

* Break comment line for flake max line length
2017-06-14 00:07:03 +02:00
Noam Meltzer
da8a3cee44 Merge pull request #631 from jeffffc/paymenthandlers
Add both handlers for queries from new Payment API
2017-06-09 18:23:29 +03:00
Eldin
bc3669fa4b make commandhandler case insensitive 2017-06-09 17:45:15 +03:00
Eldin
7def2c53e1 fix tests for pycharm windows
Refractored self.id in new tests to self._id (as I did before) so testrunner in pycharm can run under Windows.
2017-06-09 17:44:43 +03:00
Eldin
0afb38f45c Fix video_note tests
Added a video_note to send.
2017-06-09 12:27:10 +03:00
Noam Meltzer
2680740316 Merge pull request #641 from azogue/fixes
fix setting default mimetype of inputfile
2017-06-03 00:22:32 +03:00
Jeff
b6ba66ba8e Fix typo in filter test 2017-06-03 02:05:26 +08:00
Jeff
eaf765dcbc Remove duplicated/useless codes, added Filters.invoice test 2017-06-03 01:48:30 +08:00
Jeff
e9d08c6f7a Merge branch 'master' into paymenthandlers-new
# Conflicts:
#	telegram/bot.py
#	telegram/message.py
#	telegram/precheckoutquery.py
#	telegram/shippingquery.py
2017-06-03 01:09:17 +08:00
Noam Meltzer
0ed997cc53 Merge remote-tracking branch 'origin/master' into payment 2017-06-01 22:07:14 +03:00
Jacob Bom
760737345d Fix tests for video_note
It would seem that length is no longer incorrectly required so that's good
However they stopped sending the file_size when you send via a file_id which is a bit odd
2017-06-01 22:06:34 +03:00
Noam Meltzer
137ffe2e73 Merge remote-tracking branch 'origin/master' into payment 2017-06-01 22:01:04 +03:00
Noam Meltzer
ee1cf6b9b0 test_set_webhook_get_webhook_info: Retry more
Unitests fail too much on this one. Lets retry more, maybe we'll stop
seeing this.
[ci skip]
2017-06-01 21:25:00 +03:00
evgfilim1
f66076b06c Returned old tests 2017-06-01 16:37:39 +05:00
evgfilim1
d0f6860bac Fixed tests to use new filters 2017-06-01 07:10:26 +05:00
azogue
84b59c8cb2 unittest sending non standard jpg photo with bytesio stream 2017-05-29 09:38:02 +02:00
Noam Meltzer
ae33d33580 Merge pull request #625 from python-telegram-bot/videonote
Add VideoNote
2017-05-26 19:34:13 +03:00
Jacob Bom
f4c6197c5f Update filters to new_chat_members instead of new_chat_member 2017-05-25 14:45:47 +02:00
Jeff
73ac259721 fix typo... 2017-05-23 00:13:30 +08:00
Jeff
27238c52e2 add successful_payment filter under message 2017-05-22 23:39:28 +08:00
Jeff
3767d26fc8 Add both handlers for queries from new Payment API (#630)
* add handlers for new payment API

* fix typo

* fix docstring mistakes

* added missing 'from_user'
2017-05-22 14:07:53 +02:00
Jacob Bom
acda19b7e7 Merge branch 'may18minor' into beta 2017-05-21 15:45:40 +02:00
Jacob Bom
48fa3d975b Merge branch 'videonote' into beta
# Conflicts:
#	telegram/__init__.py
#	telegram/message.py
2017-05-21 15:45:20 +02:00
Jacob Bom
d220ff4e38 Merge branch 'payment' into beta 2017-05-21 15:42:24 +02:00
Jacob Bom
5a15d1b5d6 Add mpeg4_duration and gif_duration to inline gif and mpeg4gif 2017-05-21 14:38:12 +02:00
Jacob Bom
99ecac5649 assertRaisesRegex doesn't exist on py2 (also fuck yapf)
This deprecation is totally gonna come back and bite us when the regexp
gets removed completely in never version´
2017-05-21 14:10:55 +02:00
Jannes Höke
1c4c228cf1 add support for User.language_code (#624)
* add support for User.language_code

* Add language filter

Useful is you wanna do something like restrict your shop to a single or a few locales or something like that.
2017-05-21 14:00:53 +02:00
Jacob Bom
2e89e21261 Fix text_markdown and text_html (#623)
* Fix text_markdown and text_html

* Missed a few narrow build checks

* Added tests for emoji-first strings and emojis in url
2017-05-21 14:00:07 +02:00
Jacob Bom
7583fa9d65 Tests for video notes 2017-05-21 13:51:58 +02:00
Jacob Bom
73d75b964a Remove extra space from payment provider token 2017-05-20 18:55:21 +02:00
Jacob Bom
45897048aa Add invoice test and there's no EUD currency, whoops 2017-05-20 18:51:31 +02:00
Jacob Bom
9f6ec125b9 Basic tests for payment stuff 2017-05-20 17:31:46 +02:00
Jacob Bom
77f06888cb MessageEntity != Sticker :P 2017-05-20 17:31:46 +02:00
Eldinnie
e2a651afc8 Allow edited as seperate input (#608)
* Allow edited as seperate input

In short made it possible to tune messagehandler more to your wishes. and choose exactly what updates to receive. messages, edited_message or channel_post or a combination.

- Added the edited_updates argument to MessageHandler
- Added DepricationWarning when using allow_edited
- replaced _is_allowed_message and _is_allowed_channel_post with _is_allowed_update
- Modified tests to reflect new way

* oops

Spelled deprecation wrong
made an error in the _is_allowed_update.

* Python 2 does not have assertWarns.

* remove unneeded statements
2017-05-19 20:26:10 +02:00
Evgen
33512ffd2e Improved CommandHandler (#613)
* Improved CommandHandler

Now you can pass list of commands instead of one command

* Added tests for list of commands

* Return backward compatibility

Renamed `commands` to `command` in CommandHandler

* Added test for a command not in the list

* Fixed py2 unicode command support in `CommandHandler`
2017-05-19 20:21:37 +02:00
Evgen
c2c5452829 Updated docstring in deleteMessage methods (#618)
* Removed "undocumented" notice

* Updated docstring according to Bot API documentation

* Removed extra line
2017-05-19 20:21:20 +02:00
Jannes Höke
9aa5522694 sanitize html and markdown in Message.text_html and text_markdown (#621)
* sanitize html and markdown in Message.text_html and text_markdown

* add import for escape_html
2017-05-19 19:11:40 +02:00
Noam Meltzer
9a2d5e0410 Update copyright notice to include 2017 - missing files from another PR 2017-05-15 00:37:40 +03:00
Jacob Bom
1b7f83625c Update copyright notice to include 2017
Not strictly needed, but it helps show that the project is being actively
developed which I find important.
2017-05-15 00:36:49 +03:00
Jacob Bom
da01601ff9 Add equality rich comparision operators to telegram objects (#604)
fixes #587
2017-05-15 00:29:31 +03:00
Evgen
f3b75d95c4 Implemented undocumented 'deleteMessage' method (#602)
* Implemented `Bot.delete_message()` and `Message.delete()` methods

* Added tests for `Bot.delete_message()` and `Messsage.delete()`

* Added myself to `AUTHORS.rst`

* Using `assertRaisesRegexp` instead of `assertRaisesRegex` in tests

Now tests can run on Python 2.7 without raising 'AttributeError'

* Fix docstring

Added a warning to the docstring describing that this method is undocumented and not guaranteed to work
2017-05-12 17:40:57 +02:00
Eldinnie
36b98b0ab4 fix mimetype errors in video tests (#600) 2017-05-12 17:39:28 +02:00
Eldinnie
05b85d4334 Skip test_idle() and test_UserSignal on Windows (#599) 2017-05-12 17:39:14 +02:00
Eldinnie
f27807552f refactor self.id -> self._id to let pycharms testrunner run (#598) 2017-05-12 17:38:51 +02:00
Eldinnie
f3aca42e69 pass errormessage to Unauthorized (#597) 2017-05-12 17:38:36 +02:00
manorom
c5598b96bc Fix Bug #571 (second try) (#574)
* Fix Bug #571
ConversationHandler will not process CallbackQuery if per_chat=True and
the CallbackQuery has no message attached to it (as is the case with
buttons on inline results)

* Adds test case for CallbackQuery without Chat
2017-04-29 15:51:48 +02:00
Jannes Höke
c7dbdce3dc Allow CallbackQueryHandler in ConversationHandler with per_mess… (#561)
* 🐛 Allow CallbackQueryHandler in ConversationHandler with per_message=False

but show a warning #556

*  warning logs instead of ValueErrors

 #556
2017-04-29 15:15:17 +03:00
Dickson Tan
11a3de67ea Remove deprecated code #408 part 1 (#564)
* Remove non-pep8 dispatcher methods

* callbackqueryhandler: Remove non-pep8 compliant methods

* commandhandler: Remove non-pep8 compliant methods

* handler: Remove non-pep8 compliant methods

* messagehandler: Remove non-pep8 compliant methods

* stringcommandhandler: Remove non-pep8 compliant methods

* stringregexhandler: Remove non-pep8 compliant methods

* test_updater: fix usage of deprecated methods

* dispatcher: fix accidental misalignment of comments by pre-commit hook

* Add myself to list of contributors
2017-04-25 10:39:02 +02:00
Eldinnie
90bf26c09b Issue 566 (#577)
* stripping token of whitespaces before starting bot

* Line feed

* - Case insensitivity for commandhandler
- Ignore pylint case on windows.
2017-04-25 10:37:06 +02:00
Eldinnie
b5b09884b1 Group filters (#575)
* stripping token of whitespaces before starting bot

* Line feed

* show exception that's caused (fixes flake8 failing)

* Add private/group filters

Add filters:
 - Filters.private (for messages in private chats)
 - Filters.group   (for messages in group chats)

* use constants
2017-04-23 23:22:05 +02:00
Jacob Bom
ad5f009ce7 Add the ability to invert (not) filters (#552)
* Add InvertedFilter and use it from __invert__

* Add docstrings and __str__ for inverting filters

* Tests for inverted filters
2017-03-28 18:38:44 +02:00
Jannes Höke
ff39e2436e Refactor Update.extract_ methods to Update.effective_ properties (#531)
* 🔨 Refactor `Update.extract_` methods to `Update.effective_` properties
 #507

* 🔨 handler.py: use effective_ properties
2017-03-26 14:36:34 +02:00
Alex Hirschfeld
5b14b134dc Added user defined function for updater's signalHandler (#512)
* Added user defined function for updater's signalHandler

* Added test_userSignal to test_updater

* Added test_userSignal to test_updater
Fixing paren
2017-03-26 14:36:13 +02:00
Jannes Höke
5897affa07 add missing allowed_updates to start_webhook (#549)
* 🐛 add missing allowed_updates to start_webhook
 #548

* 🔨 fix webhook-related tests
 #548
2017-03-25 12:46:37 +01:00
thodnev
22142e7cbd Introduce MessageQueue (#537)
* Introduce MessageQueue

* minor documentation and terminology fixes according to the review

* minor documentation and terminology fixes according to the review

* minor documentation and terminology fixes according to the review

* pep8 fix
2017-03-15 17:35:33 +01:00
Jose Luis Salazar Gonzalez
e78d11a99b Add filters to commandHandler (#536)
* Add filters to commandHandler

* Add commandHandler tests with filters

* Add myself to authors
2017-02-28 15:44:55 +01:00
Jannes Höke
cc73469dab Issue 502 (#530)
* conversationhandler.py: add per_chat, per_user and per_message

* test_conversationhandler.py: test case per_user=False

* test_conversationhandler.py: add test for callbackqueryhandlers

* ✏️ Fix accidental typo in logging format
2017-02-27 17:52:58 +01:00
Jannes Höke
69bfb85298 Fix tests (missed one)
#494
2017-02-27 15:35:57 +01:00
Jannes Höke
f267646828 Fix tests
#494
2017-02-27 15:23:48 +01:00
Jannes Höke
a1ade408b0 🔀 Merge master into dec04
#483
2017-02-27 14:39:18 +01:00
Eldinnie
34ebb7fe5a Issue 520 (#521)
* stripping token of whitespaces before starting bot

* Line feed

* fixed chat parameter all_members_are_administrators
2017-02-27 14:27:06 +01:00
Eldinnie
78094b796d Fix commandhandler (#515)
* stripping token of whitespaces before starting bot

* Line feed

* CommandHandler checks if message is for this bot

* CommandHandler checks if message is for this bot
- Added tests

* Fixed tests in test_conversationHandler to work with new commandhandler structure

* type in conversationhandler test
2017-02-27 14:26:53 +01:00
Noam Meltzer
d714da4b36 Merge pull request #500 from python-telegram-bot/bug470
Fix bad formatting of BadRequest exception message

Fixes #470
2017-02-25 22:40:49 +02:00
Rahiel Kasim
0507378509 fix typo's (#523) and comment out failing sticker test 2017-02-18 16:03:50 +01:00
Rahiel Kasim
659ac52d92 fix tests (telegram cache file_id's) 2017-02-05 23:10:48 +01:00
Joscha Götzer
ac59f2f37c Added methods to generate the original markdown/html string from entities contained in Message (#507)
* Added methods to generate the original markdown/html formatted string from the entities contained in an update

* Added

* Moved the html/markdown parsing methods to `Message`

* Moved extract_* methods from helpers to the appropriate location

* Refactored text_markdown and text_html

* Refactored text_markdown and text_html for efficiency

* Fixed method call in conversationhandler

* Fixed method call in handler

* Fixed `make test` command on windows systems

* Improved method documentation
2017-01-20 20:13:58 +01:00
Jannes Höke
86c8ebbfb7 fix tests 2017-01-16 00:28:47 +01:00
Jannes Höke
975d193441 Merge branch 'master' into dec04 2017-01-16 00:15:09 +01:00
Jannes Höke
8ac66698b5 test_bot.py: unit test setWebhook and deleteWebhook 2017-01-16 00:01:32 +01:00
Noam Meltzer
4c7cc3a05b Fix test_set_game_score3 - telegram changed something in their responses 2017-01-07 23:37:23 +02:00
Noam Meltzer
191e442e59 test_jobqueue.py: Fix time delta calculations on several tests 2017-01-07 20:13:08 +02:00
Noam Meltzer
58dddfd9c3 Control the read timeout from telegram servers
refs #495
refs #364
2017-01-07 20:13:08 +02:00
Noam Meltzer
ed1785981d disable test_send_contact 2016-12-20 00:12:57 +02:00
Jannes Höke
cbf93e1046 switch to run_x naming scheme 2016-12-14 18:01:44 +01:00
Jannes Höke
d5ce32c672 removed Job.run_immediately and related code 2016-12-14 17:15:52 +01:00
Jannes Höke
09ddc1b1a8 DAAAANGER ZOOOONE 2016-12-14 16:27:45 +01:00
Jannes Höke
8ead72e3ef jobqueue: add support for specifying next_t in datetime.datetime or datetime.time 2016-12-13 23:38:13 +01:00
Jannes Höke
0cd7ecab50 fix test_filters_reply 2016-12-11 23:16:10 +01:00
Jeong Arm
c5f9e53d44 Add "reply" filter (#465)
* Add "reply" filter

This filter will filter messages that reply to other's message.

* Add test for "reply" filter

* Add "Kjwon15" to AUTHORS.rst
2016-12-11 22:45:51 +01:00
Noam Meltzer
acf1541395 Botapi2.3 (#471)
* New fields channel_post and edited_channel_post for Update

refs #468

* setGameScore() changes

 - Changed behaviour: messages with high scores will be update with new
   high scores by default. (documentation fix)
 - Use (new) disable_edit_message in setGameScore to disable the above new
   behaviour.
 - The edit_message parameter from setGameScore is no longer in use. For
   backward compatibility, it will be taken into account for a while,
   unless disable_edit_message is passed explicitly.

refs #468

* New field forward_from_message_id for Message.

refs #468

* New parameter cache_time for answerCallbackQuery

refs #468

* replykeyboardhide renamed to replykeyboardremove

refs #468

* Unitests for updated setGameScore semantics

refs #468

* Backward compatibility for ReplyKeyboardHide

refs #468

* Fix docstrings of wrapper methods in Message

* Unitest new field forward_from_message_id of Message

refs #468

* Fix testMaxCaptionLength

Telegram servers changed their behaviour - now they truncate a long
caption instead of returning an error.

* MessageHandler: Added support for channel posts

* Fix flake8 complaints in a manner which yapf will like it too.

* fix rst markup
2016-12-11 22:44:52 +01:00
lisitsky
a2fddbe85c Fix telegram API change, returning '404 Not found' (#461)
* Fix telegram API change, returning '404 Not found' with raising own TelegramError rather native exception

* Change exception to InvalidToken in test and request util

* Added myself to AUTHORS. Thx for appreciation :)
2016-11-09 14:36:42 +01:00
Wesley Gahr
68e87db909 Job queue time units (#452)
* Adding timeunit and day support to the jobqueue

* Adding tests

* Changed the file permission back to 644.

* Changed AssertEqual argument order to (actual, expectd).

* Removed the TimeUnit enum and unit param, instead use datetime.time for interval.

* Removing the TimeUnits enum and unit param in favour of optionally using a datetime.time as the interval.

* Removing the TimeUnits enumeration, forgot the remove it in the last one.

* Removed some old docstrings refering to the TimeUnits enum.

* Removed the old TimeUnits import.

* Adding some error handling for the 'days' argument (only a 'tuple' with 'Days')

* Writing the error message directly in the exception.

* Moving a debug statement wrongfully saying a job would be running on days it wouldn't.

* Writing error messages directly in the exceptions instead of making an extra variable.

* Replacing datetime.time in favour of datetime.timedelta because of the get_seconds() method.

* Adding error handling for the method .

* Splitting the tests up in multiple ones, no float test because I haven't found a reliable way to test it.

* Excluding .exrc file.

* Removing \ at EOF of ValueError.

* Replacing Enums with plain new-style classes.

* Using numbers.number to check for ints/floats instead of seperate int/float checks.

* Fixing typo, number -> Number.

* Changed lower_case Days attributes to UPPER_CASE.

* Different formatting for Days class, removed the get_days function in favour of a tuple.

* Removed redundant function get_days.

* Edited the docstring for next_t to also take datetime.timedelta.

* Removed for-loop in favour of any().

* Changed docstring for interval.

* Removed debug print.

* Changing some docstrings.

* Changing some docstrings (again).
2016-11-08 23:39:25 +01:00
Jannes Höke
10bdf8212c Add pass_user_data and pass_chat_data to Handler (#436)
* initial commit for user_data

* add chat_data and use defaultdict

* fix chat_data copy-paste error

* add test for user_data and chat_data

* fix case where chat is None

* remove braces from import line
2016-10-25 19:28:34 +02:00
Jacob Bom
960862ccb1 Merge branch 'master' into october3
# Conflicts:
#	telegram/bot.py
#	telegram/callbackquery.py
#	telegram/chat.py
#	telegram/ext/messagehandler.py
#	telegram/inlinekeyboardbutton.py
#	telegram/inlinequeryresultcachedaudio.py
#	telegram/message.py
#	tests/test_filters.py
2016-10-19 12:35:50 +02:00
Jacob Bom
4e5f4582dd Merge pull request #411 from python-telegram-bot/bitwise-filters
Make filters and/or-able using bitwise operators.
2016-10-19 11:40:35 +02:00
Noam Meltzer
78088f4f6a Fix grammer: 'a object' -> 'an object' 2016-10-17 01:22:40 +03:00
Jacob Bom
39832d2f6b __str__ behaves differntly on py2 apparently. 2016-10-16 13:19:42 +02:00
Jacob Bom
5408c23e33 assertRegexMatches still exists for now. Use it. 2016-10-16 12:48:45 +02:00
Jacob Bom
305ff93018 set_game_score might return True 2016-10-16 12:41:12 +02:00
Jacob Bom
29e0cc64e9 Fix py2 compat 2016-10-15 23:29:46 +02:00
Jacob Bom
a5671a8fb1 Merge pull request #423 from python-telegram-bot/edit-class-method
Add edit_* class methods
2016-10-15 23:03:43 +02:00
Jacob Bom
f99b2f8f3b Inprove coverage 2016-10-15 22:59:41 +02:00
Noam Meltzer
53a574bbbb Improve unitests coverage 2016-10-13 22:52:53 +03:00
Noam Meltzer
5b8efe0c14 upgrade yapf to ver 0.12.2 2016-10-12 23:56:57 +03:00
Noam Meltzer
32a78722ae yapf fixes 2016-10-12 23:33:52 +03:00
Jacob Bom
04feeeff55 Update test cases
Needs proper animation file_id and size.
Also assertEqual can't test if two objects have the same data, so we just check the file_id instead.
2016-10-12 20:30:34 +02:00
Patrick Hofmann
8dc10fc7b2 fixes broken test cases with PhotoSize, Game and Animation classes (#435)
* fixes broken test with PhotoSize, Game and Animation

However:
testSendGame and test_set_game_score both produces *BadRequest: u'Wrong file identifier/HTTP URL specified'*.

* fixes test_set_game_score

* adds to_dict method to Game to prevent extra collection type checks in base.TelegramObject
2016-10-10 11:44:40 +02:00
Jacob Bom
7ad92dcc65 Add test for set_game_score 2016-10-09 12:39:05 +02:00
Jacob Bom
d1ddfaddf0 Add tests for Game, Animation and sendGame.
Still need setGameScore (I'm thinking we can set it to the ever increasing
envvar 'TRAVIS_BUILD_NUMBER') and getGameHighScores.
The tests currently don't work... Since I don't really understand how
PhotoSize works... Please halp :P
2016-10-07 23:57:10 +02:00
Jacob Bom
b7c7612b3f Add game filter 2016-10-07 22:37:29 +02:00
Jacob Bom
ade89772f4 Fix tests
Data is an optional kwargs in CallbackQuery according to Telegram
2016-10-07 22:32:54 +02:00
Noam Meltzer
bfb4c63d60 add unitest for getWebhookInfo 2016-10-06 00:11:28 +03:00
Noam Meltzer
1db1b76a7c fix test_video unitest 2016-10-05 23:19:17 +03:00
Jacob Bom
976f34082f Add possibly good-enough test for all_members_are_admin
Should be good enough... If we /really/ wanted to we could get two different chats from telegram and check them, but it really shouldn't be necessary.
2016-10-05 17:55:00 +02:00
Jacob Bom
6b7788570c Add tests for captions in audio and voice 2016-10-05 17:50:48 +02:00
Noam Meltzer
3c889655c1 Allow http url as a file_id
N.B. test_send_video_mp4_file_url() is still failing, probably because
of telegram servers bug. Will contact telegram bot support about that.
2016-10-04 00:20:17 +03:00
Jacob Bom
c2b8c4bf95 Fix regexGroupHandlerCallbackQuery test 2016-10-03 21:29:30 +02:00
Jacob Bom
8234321a20 Fix tests for Inline Voice Queries 2016-10-03 21:28:35 +02:00
Michael Elovskikh
46657afa95 Start additional threads only when necessary (#415)
* Start all additional threads only when necessary.

* Deprecate prevent_autostart in the c'tor of JobQueue.
2016-09-27 10:21:35 +03:00
Jacob Bom
9928a1eefc Add test for edit_text 2016-09-25 16:11:19 +02:00
Jacob Bom
3244417f61 Add docs for filters. 2016-09-25 00:30:04 +02:00
Jacob Bom
61596400e1 __call__ should return the result
Also add tests with both & and |.
2016-09-24 18:56:54 +02:00
Jacob Bom
be0f5bc519 Merge branch 'master' into bitwise-filters
# Conflicts:
#	telegram/ext/messagehandler.py
#	tests/test_filters.py
2016-09-24 18:30:58 +02:00
Jacob Bom
921fbae2f3 Merge branch 'master' into bitwise-filters 2016-09-24 18:21:06 +02:00
Jannes Höke
8e80a8d273 comment out test_reply_contact 2016-09-24 14:25:31 +02:00
Jannes Höke
cbe057083f fix test_send_photo_resend 2016-09-24 14:16:04 +02:00
Jacob Bom
1b99caa2f9 Merge remote-tracking branch 'origin/master' into entities-filter 2016-09-24 13:46:55 +02:00
Jacob Bom
e16c1da6b1 Change entities filter to be singular.
Also remove the faulty example completely since it should be no longer needed.
2016-09-24 13:38:56 +02:00
Jannes Höke
5116a77221 Class methods (#362)
* bot.py: add create_references method

* create bot reference in webhook handler, use create_references on new updates

* message.py: implement reply_text

* echobot2.py: use Message.reply_text

* fix create_references in webhook handler

* add some more instance methods

* Chat.kick_member and unban_member

* bot.py: Create bot references in outgoing messages

* add tests for everything testable

* test_updater.py: add create_references method to MockBot

* remove Bot.create_references and refactor TelegramObject.de_json to take the additional parameter bot

* List bot as named kwarg where used

* file.py: Use Bot.request property instead of Bot._request attr
2016-09-20 06:36:55 +02:00
Jannes Höke
1efd330e59 ConversationHandler: Fix #373 2016-09-20 05:00:39 +02:00
Jacob Bom
f34c09dd72 Fix image sizes in tests. 2016-09-14 19:58:30 +02:00
Jacob Bom
71e74da0a2 Make filters and/or-able using bitwise operators.
See associated PR for more info.
2016-09-14 19:29:15 +02:00
Jacob Bom
7ab007d8d4 Add Filters.entities test. 2016-09-13 20:47:43 +02:00
Rahiel Kasim
5285f63e4a Merge pull request #388 from python-telegram-bot/emoji
deprecate telegram.Emoji
2016-09-13 19:25:58 +02:00
Jacob Bom
6647ae3c25 Add methods to parse entities in Message
Should close #400.

* Add parse_entity

* Add parse_entities

* Add MessageEntity types as constants to MessageEntity.

* Add MAX_MESSAGE_ENTITIES to constants.py
Note: the value has been found by experimentation as opposed to extracted from the api docs.

* Add tests for parse_entity and parse_entities
2016-09-07 08:49:09 +02:00
Noam Meltzer
e4a132c0e4 Reusable dispatcher (#402)
* Create a Request class which maintains its own connection pool
* When creating a Bot instance a new Request instance will be created if one wasn't supplied.
* Updater is responsible for creating a Request instance if a Bot instance wasn't provided.
* Dispatcher: add method to run async functions without decorator
* Dispatcher can now run as a singleton (allowing run_async decorator to work) as it always did and as multiple instances (where run_async decorator will raise RuntimeError)
2016-09-06 16:38:07 +03:00
Rahiel Kasim
da87d4ba78 fix yapf 2016-08-26 11:17:05 +02:00
Rahiel Kasim
fe14000515 remove tests for telegram.Emoji 2016-08-21 11:58:00 +02:00
Rahiel Kasim
00bba73673 drop Python 2.6 support (closes #245) (#386)
* drop Python 2.6 support (closes #245)

* fix NullHandler import

* README: explicitly mention Py3 and PyPy compatibility
2016-08-20 22:01:07 +02:00
Jannes Höke
555e36ee80 tests 2016-08-06 14:47:45 +02:00
Jannes Höke
ad3eec2af8 ConversationHandler (#331)
* initial commit for conversationhandler and example

* implement simple Promise for run_async/conversationhandler

* refactor Promise._done to done

* add handling for timed out Promises

* correctly handle promises with None results

* fix handling tuple states

* update comments on example

* Added a first test on the ConversationHandler.

* Fixed a small typo.

* Yapf'd.

* add sphinx doc for conversation handler

* fix title for callbackqueryhandler sphinx docs
2016-07-15 01:30:54 +02:00
Rahiel Kasim
04a871aff5 introduce constants module (#342) 2016-07-14 21:48:31 +02:00
Noam Meltzer
35872d7a8b test_jobqueue: fix test_jobs_tuple()
this test was based on timing and assumed that the JobQueue did not have
time to start processing the queue before checking the assert.
what we really should do is make sure JobQueue does not process anything
2016-06-24 19:13:40 +03:00
Jannes Höke
c4a8ee5175 Merge branch 'master' into jobqueue-rework
Conflicts:
	tests/test_jobqueue.py
2016-06-20 05:32:15 +02:00
Jannes Höke
738e3213a7 Merge branch 'master' into jobqueue-rework 2016-06-20 00:49:01 +02:00
leandrotoledo
b41f7e3e79 Code style with latest yapf 2016-06-19 17:50:02 -04:00
Noam Meltzer
bc77c845ea test_updater: make sure that conpool is stopped before setting updater
even for the first unitest, it might come after another unitests from
another file which had already init the conpool.
2016-06-18 09:53:08 +03:00
Noam Meltzer
a814e9de6b make sure to stop conpool between sensitive unitests 2016-06-18 00:50:44 +03:00
Noam Meltzer
d37b6d6735 make sure to stop Updater after the test_createBot is over 2016-06-18 00:01:36 +03:00
Noam Meltzer
cb6ddfded5 Merge remote-tracking branch 'origin/master' into urllib3 2016-06-17 17:54:04 +03:00
leandrotoledo
f0b91ecf46 Fix travis 2016-06-03 13:44:24 -04:00
Jannes Höke
de2d732135 Merge branch 'master' into jobqueue-rework
Conflicts:
	README.rst
	telegram/ext/commandhandler.py
	telegram/ext/messagehandler.py
2016-05-31 15:34:36 +02:00
Noam Meltzer
b040568b07 test_bot: fix for urllib3 compatibility 2016-05-30 01:05:19 +03:00
Rahiel Kasim
f31bd91673 Merge pull request #305 from python-telegram-bot/move-botan
move botan from utils to contrib
2016-05-28 21:32:07 +02:00
Rahiel Kasim
c8497424b7 move botan to contrib 2016-05-28 09:12:10 +02:00
Leandro Toledo
80fbe98b44 Reflecting tests for Filters change 2016-05-27 21:14:55 -03:00
Jannes Höke
a0bb5730c6 add allow_edited parameter to MessageHandler and CommandHandler 2016-05-27 11:07:06 +02:00
Leandro Toledo
9a13de4a96 Merge remote-tracking branch 'origin/master' into bot2.1
Conflicts:
	telegram/bot.py
	tests/test_bot.py
2016-05-26 16:15:50 -03:00
Noam Meltzer
561f1c3f02 bot: validate token does not contain white spaces (#306)
in addition move validation code from validate.py into bot.py and delete
the former file
2016-05-26 22:09:14 +03:00
Jannes Höke
bb165b6acf add pass_job_queue parameter to all handler classes 2016-05-26 14:39:11 +02:00
Jannes Höke
20067ff178 add test for context parameter 2016-05-26 14:07:44 +02:00
Leandro Toledo
663fa0013d merge master 2016-05-25 22:09:18 -03:00
Leandro Toledo
1e398821a0 Introducing telegram.error.BadRequest and testLeaveChat testcase #302 2016-05-25 21:15:17 -03:00
Jannes Höke
3aedd78e29 make job queue API similar to the dispatcher, add new functionality 2016-05-25 23:36:41 +02:00
Rahiel Kasim
386b91f708 refactor testing if user is bot 2016-05-25 09:41:48 +02:00
Rahiel Kasim
76b9a7d328 add tests for Bot.getChat* 2016-05-25 01:31:10 +02:00
Rahiel Kasim
c4d5eff9f3 move botan from utils to ext 2016-05-24 23:40:09 +02:00
Leandro Toledo
046e69b1c1 Commenting test for token with newline 2016-05-23 22:02:15 -03:00
Leandro Toledo
0b2fd120d8 Due kwargs I had to change the factory class in favor of InputLocationMessageContent #302 2016-05-23 21:09:07 -03:00
Leandro Toledo
7c84516d2b Merge branch 'master' of github.com:python-telegram-bot/python-telegram-bot 2016-05-23 19:44:34 -03:00
leandrotoledo
c7db9a96cd Set split_before_logical_operator to True 2016-05-23 17:19:35 -03:00
Leandro Toledo
af89cbecf3 Add test for unstripped tokens [ci skip] 2016-05-22 18:22:22 -03:00
leandrotoledo
eb303903ef Fix travis 2016-05-22 12:55:48 -03:00
Jannes Höke
f5847be8ca update file size from 684 to 685 2016-05-17 10:19:00 +02:00
Leandro Toledo
880746baed Column width to 90 #259 2016-05-14 21:52:35 -03:00
Leandro Toledo
8ad1f330ea First run of yapf for tests/* #259 2016-05-14 21:39:11 -03:00
Jannes Höke
4d8174edc3 check for py2 and decode 2016-05-12 08:31:47 +02:00
Jannes Höke
235bb72702 use future.utils.text_to_native_str 2016-05-12 08:17:05 +02:00
Rahiel Kasim
9a5ccb1c2d fix sticker emoji test
We always get utf-8 text from Telegram, so we compare to that.
2016-05-12 01:10:04 +02:00
Jannes Höke
c551d71735 add emoji field to sticker 2016-05-11 23:19:35 +02:00
Jannes Höke
6ec81dd552 move cleaning updates to bootstrapping phase (#282) 2016-05-11 00:58:55 +03:00
Jannes Höke
0e0611767a add location attribute #272 2016-05-01 20:08:34 +02:00
Jannes Höke
d940afa718 merge master into cr4.0 2016-04-29 18:37:41 +02:00
Noam Meltzer
e160355190 remove unused imports, use future for urllib imports 2016-04-28 01:41:32 +03:00
Leandro Toledo
d80e0b4b8c Add more test cases 2016-04-26 22:48:02 -03:00
Jannes Höke
7f463131aa re-order imports 2016-04-27 00:28:21 +02:00
Leandro Toledo
a79f636345 Formatting 2016-04-26 19:08:35 -03:00
Leandro Toledo
4a4dbcdbf8 unittest2 for py2 2016-04-26 19:02:17 -03:00
Leandro Toledo
7b13adb34b Renaming methods for InlineKeyboardButton 2016-04-26 18:58:22 -03:00
Leandro Toledo
e905f310c4 Renaming methods for KeyboardButton 2016-04-26 18:57:52 -03:00
Leandro Toledo
631c825c1d Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-26 18:51:02 -03:00
Leandro Toledo
ed7ecddb8d address to _address due nose limitations 2016-04-26 18:50:47 -03:00
Jannes Höke
a3dae1f112 use correct filter in command filter test 2016-04-26 23:49:59 +02:00
Leandro Toledo
1d33c39a1b Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-26 18:43:56 -03:00
Leandro Toledo
14d3f62e44 Minor fix 2016-04-26 18:43:39 -03:00
Jannes Höke
931b22f49e tests for Filters 2016-04-26 23:42:58 +02:00
Leandro Toledo
f0aafda1b9 Add KeyboardButtonTest 2016-04-26 18:40:48 -03:00
Leandro Toledo
ecb6ddd83d Add VenueTest 2016-04-26 18:34:25 -03:00
Leandro Toledo
cb46b0373f Add MessageEntityTest and reformatting. 2016-04-26 18:29:13 -03:00
Leandro Toledo
35f6de326b Add InlineKeyboardButtonTest and reformatting. 2016-04-26 18:23:15 -03:00
leandrotoledo
1f29093027 Merge branch 'unittest-bot2.0' of https://github.com/python-telegram-bot/python-telegram-bot into unittest-bot2.0 2016-04-26 14:17:59 -03:00
Noam Meltzer
3f28633e79 MessageHandler / filters: refactor
filters are now functions instead of enum like objects.
their definitions were moved to messagehandler.py
2016-04-26 17:47:37 +03:00
Leandro Toledo
c0d63deae3 Merge remote-tracking branch 'origin/unittest-bot2.0' into unittest-bot2.0 2016-04-24 14:33:04 -03:00
Leandro Toledo
f152195a68 Minor fix 2016-04-24 14:32:52 -03:00
Jannes Höke
b2fd2ba697 add callback data 2016-04-24 19:00:21 +02:00
Jannes Höke
01cca924ca inlinekeyboardmarkup test (failing) 2016-04-24 16:30:53 +02:00
Leandro Toledo
4b173bfd52 Add tests for InputContactMessageContent InputLocationMessageContent InputTextMessageContent InputVenueMessageContent 2016-04-24 11:08:06 -03:00
Leandro Toledo
ca1fff25f7 Some code reformat and minor fixes 2016-04-23 23:11:25 -03:00
Leandro Toledo
0d6b3a5411 Seems like self.address conflicts with nose. Validating... 2016-04-23 22:47:50 -03:00
Leandro Toledo
6cacea96f7 No clue what's going on with travis and Venue 2016-04-23 22:43:48 -03:00
Leandro Toledo
4775107af0 Trying to isolate the problem. 2016-04-23 22:40:52 -03:00
Leandro Toledo
fe06708d34 Trying to isolate the problem. 2016-04-23 22:37:59 -03:00
Leandro Toledo
6390b7fd9b Going deeper... 2016-04-23 21:43:27 -03:00
Leandro Toledo
2160ce70a6 This piece of code killed Travis somehow, investigating. 2016-04-23 21:40:36 -03:00
Leandro Toledo
5e5125444c Adding all the others inlinequeryresult tests #188. 2016-04-23 21:26:59 -03:00
Leandro Toledo
f86e6f97db Adding some inlinequeryresult tests #188. 2016-04-23 21:06:18 -03:00
Leandro Toledo
325d8131ee Adding input_message_content and reply_markup for existing inlinequery* tests. 2016-04-23 20:40:51 -03:00
Leandro Toledo
f68b8c3a4a Adds InputContactMessageContent class, fixes InlineQueryResultArticle tests, de_json super calls for replymarkup objects and factory for InputMessageContent #188 2016-04-23 20:19:51 -03:00
leandrotoledo
4c0737d7c1 Moving InlineQuery* classes to its own test files 2016-04-23 10:47:10 -03:00
leandrotoledo
5dd95f1968 Renaming some tests 2016-04-23 10:39:52 -03:00
Jannes Höke
b30417681b Merge pull request #248 from python-telegram-bot/bytes-images-py2
InputFile to support any objects with .read attribute
2016-04-23 14:36:59 +02:00
leandrotoledo
37e48b4707 Fixing BufferedReader test #248 2016-04-23 09:23:03 -03:00
leandrotoledo
252abb138d Using hasattr instead isinstance for file check #119 2016-04-22 21:51:00 -03:00
Jannes Höke
cb79317354 remove lazy import of JobQueue 2016-04-21 20:37:43 +02:00
Jannes Höke
cfdfdeb4fc Merge branch 'bot-api-2.0' into dispatcher-rework 2016-04-21 17:20:05 +02:00
Leandro Toledo
0669c72fe3 Fixing little princes Python 2.6 string format arg #232 2016-04-21 12:18:51 -03:00
Leandro Toledo
a8255e4f51 Revert switch_inline_query #232 2016-04-21 11:42:02 -03:00
Leandro Toledo
e56c6dfab6 Revert "Minor fixes #232"
This reverts commit 720c4d22d8.
2016-04-21 11:20:09 -03:00
Leandro Toledo
720c4d22d8 Minor fixes #232 2016-04-21 10:56:38 -03:00
Leandro Toledo
bb36c725af More refactoring and docstrings #232 2016-04-21 09:21:12 -03:00
Jannes Höke
9bf5da5ed3 add test for callback query handler 2016-04-21 13:07:44 +02:00
Jannes Höke
de5619f3ca tests 2016-04-18 18:50:49 +02:00
Leandro Toledo
dd8f94885a Commenting out deprecated arguments #232 2016-04-16 13:59:15 -03:00
Leandro Toledo
15cc410c10 Merge remote-tracking branch 'upstream/master' into bot-api-2.0 2016-04-16 13:16:49 -03:00
kiddick
a9b305edd0 Fix class declaration according to consistency. (#235) 2016-04-15 17:20:37 +03:00
Leandro Toledo
390184f605 Replacing assertIsInstance() to assertTrue(isinstance()) #232 2016-04-14 03:52:35 -03:00
Leandro Toledo
086fa1251c Minor fixes #232 2016-04-14 03:40:26 -03:00
leandrotoledo
ba0ea4f268 Add TOKEN and CHAT_ID for testing in favor of #221 2016-03-31 15:36:18 -03:00
Jannes Höke
6db377d56d Only set webhook if using SSL and also send certificate 2016-03-23 10:11:10 +01:00
leandrotoledo
da193711b1 Add legacy imports test to Dispatcher and JobQueue 2016-03-22 11:12:47 -03:00
Jannes Höke
63a83d4cc2 fix imports of updatequeue 2016-03-22 02:48:56 +01:00
Noam Meltzer
2939885c5b test_updater: import Updater from telegram.ext 2016-03-15 22:08:06 +02:00
Noam Meltzer
f07f33e160 updater: unitests for _set_webhook 2016-03-15 22:02:34 +02:00
Rahiel Kasim
98112d3987 move Updater and friends to ext submodule 2016-03-14 14:50:12 +01:00
Aydar Biktimirov
0600b2634e added tests for disable_notification parameter 2016-03-11 09:37:43 +03:00
Noam Meltzer
a0a040a9c2 updater: allow cleaning updates from Telegram servers before start 2016-03-01 22:12:12 +02:00
Jannes Höke
75c6662f35 leverage timing a bit more 2016-02-28 02:11:48 +01:00
Jannes Höke
b5875a3abd increase timing for repeatedly failing travis test 2016-02-28 01:53:18 +01:00
Jannes Höke
4aca4d1d1f Merge pull request #187 from python-telegram-bot/flaky-tests
Flaky tests
2016-02-28 01:02:11 +01:00
Noam Meltzer
2e6db1330f test_botan.py: another flaky test 2016-02-27 23:39:03 +02:00
Noam Meltzer
26f87c4873 test_video.py: specify timeout for the sendVideo operation itself 2016-02-27 23:01:22 +02:00
Noam Meltzer
d2623d2671 test_voice.py: adapt to latest changes in the API 2016-02-27 22:53:40 +02:00
Noam Meltzer
ec8cd37345 test_video.py: adapt to latest changes in the API 2016-02-27 22:50:28 +02:00
Noam Meltzer
d5b35e7e1d unitests: remove docstrings & prints - not needed with nosetests 2016-02-24 00:45:49 +02:00
Noam Meltzer
e0cf0abb1b flaky tests: try up to 3 times, need to succeed once 2016-02-22 01:52:31 +02:00
Noam Meltzer
ec13a36bdd unitests: use home brewed timeout for tests 2016-02-22 01:38:26 +02:00
Jannes Höke
d05fa1275a use timed tests and flaky 2016-02-21 12:52:47 +01:00
Jannes Höke
efd10507d0 remove kwargs in favor of named keyword arguments, validate argument types 2016-02-21 11:33:34 +01:00
Jannes Höke
ca526fba73 improve unit tests according to comments 2016-02-20 12:14:34 +01:00
Jannes Höke
e2cc8db992 Merge branch 'master' into inlinebots 2016-02-20 11:17:34 +01:00
Noam Meltzer
7d39e1bdef updater: more unitests for webookhandler 2016-02-19 18:00:57 +02:00
Jannes Höke
c55c5408b1 tests and corrections for inlinequery 2016-02-07 23:34:15 +01:00
Jannes Höke
d1dc32d849 tests and corrections for choseninlineresult 2016-02-07 23:26:38 +01:00
Jannes Höke
fc73948c82 fix to_dict tests 2016-02-07 23:25:48 +01:00
Jannes Höke
70dfb88eb5 complete tests for inline results 2016-02-07 22:56:25 +01:00
Jannes Höke
2a01292a64 Merge branch 'master' into inlinebots 2016-02-07 22:42:12 +01:00
Jannes Höke
bec81b5c3b Merge pull request #161 from tsnoam/master
better exception handling
2016-02-07 22:34:49 +01:00
Jannes Höke
17ac73c3c4 fix message to json 2016-02-07 14:46:36 +01:00
Noam Meltzer
d4beb94059 Add specific exceptions types for important errors
maintain backward compatibility with the 'old' exception by inherting
from TelegramError and using the same message
2016-02-06 18:48:55 +02:00
Noam Meltzer
034d0054ea test_audio: temp. disable duration unitest
due to telegram server bug
2016-02-06 18:34:30 +02:00
Jannes Höke
2436cab2e5 tests for gif and mpeg4 2016-02-03 02:09:05 +01:00
Jannes Höke
08836c60ca tests for InlineQueryResultPhoto 2016-01-31 10:52:04 +01:00
Jannes Höke
8d94c14504 Merge branch 'master' into inlinebots 2016-01-29 23:55:34 +01:00
Jannes Höke
69183d85f7 add test for InlineQueryResultArticle 2016-01-29 23:54:49 +01:00
Jannes Höke
142cc6e6ad add test for dispatching inline queries/results 2016-01-29 23:54:49 +01:00
Juan Madurga
c13af4d61d parse mode for HTML added 2016-01-27 11:20:32 +01:00
Juan Madurga
702544f709 fix pep8 extra lines 2016-01-26 23:58:07 +01:00
Juan Madurga
713f0d1335 add tests for replymarkup objects 2016-01-26 23:43:16 +01:00
Jannes Höke
44645d2cc6 Merge pull request #157 from jlmadurga/context-for-handlers
Add context to dispatcher
2016-01-25 17:46:14 +01:00
Oleg Shlyazhko
1000a56e0d more test vor botan module, increase coverage 2016-01-24 18:32:12 +03:00
Oleg Shlyazhko
5a2a541ae0 rename botan test correctly and move token to ENV 2016-01-23 19:09:56 +03:00
Oleg Shlyazhko
bb2cce56a3 insert correct appmetrica token instead of bot token in botan test 2016-01-23 16:58:44 +03:00
Oleg Shlyazhko
7931045bf3 test for botan analytics module 2016-01-23 14:24:49 +03:00
Juan Madurga
a6650de93d Add context parameter to dispatcher. Handlers now can updates with a context data if required 2016-01-20 19:56:41 +01:00
Leandro Toledo
2a7b03e7c2 Fix travis - file_size is irrelevant for resend test 2016-01-13 19:15:11 -02:00
Leandro Toledo
9f55c15cc7 Add sendPhoto tests, fix file_id casting to str instead unicode 2016-01-11 22:25:46 -02:00
Leandro Toledo
a32ae8b895 Merge branch 'master' into urls 2016-01-11 22:12:06 -02:00
Leandro Toledo
a539a0c3a5 Add data object for sendPhoto tests 2016-01-11 22:11:29 -02:00
Leandro Toledo
b4abf75524 Fix data objects references for tests to raw files on Githup repo 2016-01-11 21:11:10 -02:00
Leandro Toledo
12d71d5a91 Fix file_size tests for send* by URL 2016-01-11 20:33:17 -02:00
Leandro Toledo
48bf6bfab0 Adding telegram.gif for testing purposes 2016-01-11 20:20:57 -02:00
Leandro Toledo
7227ca3aab Tests for send(Audio,Voice,Video) by URL 2016-01-11 20:19:55 -02:00
Jannes Höke
d10b657521 enable sending by URL for all sendX methods 2016-01-10 15:12:42 +01:00
Jannes Höke
aa8966832b release 3.2 and update copyright notice to 2015-2016 2016-01-05 14:12:03 +01:00
Jannes Höke
2875bae881 Integrate JobQueue with Updater 2016-01-05 13:32:19 +01:00
Jannes Höke
9319903343 rename testclass 2016-01-04 11:08:43 +01:00
Jannes Höke
73f4f26da5 more tests 2016-01-04 02:36:15 +01:00
Jannes Höke
24b2bf335c Increase time for travis testing 2016-01-04 02:12:24 +01:00
Jannes Höke
fc3fa0f515 Increase time for travis testing 2016-01-04 02:11:42 +01:00
Jannes Höke
dd7d1255d1 fixes, tests and examples for job queue 2016-01-04 01:56:22 +01:00
Noam Meltzer
5d168bd479 improve unitest coverage 2016-01-04 00:34:39 +02:00
Noam Meltzer
1c8bb21790 fix python 2.6 unitests which with the backport package unittest2 2016-01-04 00:32:17 +02:00
Noam Meltzer
7734c1d6a6 fix unitests to work with new token validator 2016-01-04 00:32:13 +02:00
Jannes Höke
ea7c54ba07 Release v3.1.1, change author email everywhere 2015-12-21 21:18:53 +01:00
Jannes Höke
3c7b037eaa add additional arguments 'groups' and 'groupdict' for regex handlers 2015-12-21 20:25:31 +01:00
Jannes Höke
c15a1bc151 fix for #123 2015-12-21 19:36:17 +01:00
Jannes Höke
6e158042e1 API updates Oct and Nov 2015-12-16 15:31:02 +01:00
Jannes Höke
56ab40d94f increase time in test multiple messages 2015-12-01 21:58:39 +01:00
Gerd Augsburg
809fe4b74f Updated tests for start_webhook 2015-12-01 14:48:55 +01:00
Jannes Höke
e60694a8cc update test_webhook and add test_webhook_no_ssl 2015-11-30 23:00:56 +01:00
Jannes Höke
628a4c4eac final renaming of files and flake8 2015-11-24 21:06:55 +01:00
Jannes Höke
83d2ca3aa7 assertIsNone(...) to assertTrue(None is ...) 2015-11-24 20:40:40 +01:00