Commit Graph

3034 Commits

Author SHA1 Message Date
NotAFile
acd14d7bf3 add test checking for #1324 2019-12-07 20:43:29 +01:00
NotAFile
a4876c1ac5 Add example unit test and config for testing
Add testing configuration:
 - pytest as test framework
 - tox for creating testing environments and running tests (run with `tox`)
 - pytest-asycio for asyncio testing
 - coverage/pytest-cov for measuring test coverage
 - flake8 for pep8 checking

I've also added one quick example test demonstrating basic unit testing
and use of the basic fixtures and marks provided by pytest-asyncio.

Just this already covers a suprising 32% of the codebase, mostly through
imports, but I wouldn't expect it to be helpful yet. This should provide
a good base to build on in the future though.
2019-12-07 04:23:27 +01:00
Lonami Exo
b8aa639f3c Check for event loop method, not type (#1337) 2019-12-06 10:23:15 +01:00
Lonami Exo
03f0533139 Fix global search with filter/from_user 2019-12-05 16:19:46 +01:00
Lonami Exo
99d4001db6 Warn users with ProactorEventLoop about proxy issues (#1337) 2019-12-05 11:27:47 +01:00
Lonami Exo
b985dcd248 Fix 3.8 syntax warning and erroneous documentation
Closes #1340 (syntax warning)
Closes #1341 (outdated docs)
2019-12-05 11:14:02 +01:00
Lonami Exo
cd37478e31 Don't send pings unless the connection is made
This will hopefully avoid batching tens of ping requests which
we don't care about their results.
2019-12-02 18:36:20 +01:00
Mengyang Li
149b26fb51 Allow force_document in edit_message (#1335) 2019-11-23 11:00:51 +01:00
Lonami Exo
3a56c8b0f4 Correctly handle flood_sleep_threshold=None and large values
The docstring said large values would be converted to 1 day,
but they were not. With this change None and large values are
handled correctly.

Prevents https://github.com/tulir/mautrix-telegram/issues/380.
2019-11-18 12:51:18 +01:00
Lonami Exo
6817e19923 Fix return value of send_file(album) of the same media 2019-11-10 14:59:01 +01:00
Lonami Exo
57dd0827f4 Slight improvement on ChatAction's docs 2019-11-10 14:59:01 +01:00
painor
38b929b973 Fix several typos (#1328) 2019-11-10 11:29:43 +01:00
painor
4a1310dc21 Fix RSA key unpacking on missing fingerprint (#1324) 2019-11-05 08:54:10 +01:00
painor
4839d8bf59 Fix pin_message not accepting Message objects (#1322) 2019-11-04 09:46:17 +01:00
penn5
3d1ce845be Don't parse Button's text on click (#1315) 2019-11-01 11:47:44 +01:00
Lonami Exo
a1aaa96120 Fix iter_download would not determine file_size alone 2019-10-31 19:38:49 +01:00
Lonami Exo
a67c94787b Make getting PhotoSize byte count more reusable internally 2019-10-31 19:38:27 +01:00
Lonami Exo
7e346180d7 Fix import ssl may fail under some Python installs
It's only required for certain proxy configurations, so we
don't want it to raise ImportError while the user imports
our library.
2019-10-31 19:20:18 +01:00
Lonami Exo
6850903d17 Fix get_edit not always returning awaitable, bump v1.10.8 2019-10-31 10:44:33 +01:00
Lonami Exo
0a3d164806 Fix handling of early edits in Conversation
The incoming messages were never updated, so of course their
edit_date wasn't either. This would cause the library to be
stuck until it timed out, because the event had already
arrived before we waited for it. As an example:

    await conv.send_message('foo')
    await sleep(1)  # bot has plenty of time to respond+edit
    await conv.get_edit()
2019-10-31 10:44:33 +01:00
YouTwitFace
4a8b19b0be Remove @ya from valid usernames (#1306) 2019-10-28 18:12:47 +01:00
Lonami Exo
baacecadc5 Document some errors, bump v1.10.7 2019-10-27 18:50:21 +01:00
Manuel1510
0a8103b6e8 Replace messages.getPeerDialogs with channels.getFullChannel (#1305) 2019-10-27 18:48:41 +01:00
Lonami Exo
5dcc30dcc6 Handle connection errors during auth key generation
This should help with spurious server-side disconnects during
auth_key generation, which happen most commonly on user DC
migrations.
2019-10-24 13:48:29 +02:00
Lonami Exo
08b78f0c47 Unify retry loops in mtprotosender._connect
Now the retry count is not twice its value.
2019-10-24 13:40:09 +02:00
Lonami Exo
3039915ce9 Factor out parts from mtprotosender._connect
This will help unifying the retry loop and reconnecting
if the server disconnects us during auth key generation
which will be done in a follow-up commit.
2019-10-24 13:36:32 +02:00
Lonami Exo
ca2537941c Fix sending albums in conversations 2019-10-22 20:35:08 +02:00
Lonami Exo
6206a1a524 Minor documentation update 2019-10-21 11:45:31 +02:00
YouTwitFace
b862f215c5 Ignore channel-only permissions in megagroups (#1292) 2019-10-11 18:04:41 +02:00
Lonami Exo
09f27f0dd7 Update Telegram's RSA keys 2019-10-03 20:52:25 +02:00
Tanner Collin
72dd36bc17 Allow edit_admin on yourself (#1285) 2019-09-29 09:19:44 +02:00
Lonami
07b0583069
Bump to v1.10.6 2019-09-28 09:44:01 +02:00
penn5
88d8424474 Fix kick_participant in channels (#1284)
Presumably some server-side change made insta-unbanning no longer work.
2019-09-28 09:38:41 +02:00
Lonami Exo
5e6ff67d01 Make allow_cache do nothing for now, bump v1.10.5 (#1272) 2019-09-27 15:12:17 +02:00
Lonami Exo
a360d74a4c Mention pomegranate under projects using the library 2019-09-27 10:41:01 +02:00
Lonami Exo
7de01a5f94 Fix resending code with empty phone hash (fix #1283) 2019-09-27 10:41:01 +02:00
Lonami
6da8d1a0ec
Less confusing error for getting marked ID of PeerChannel(0)
Fixes #1282.
2019-09-24 19:01:46 +02:00
Lonami Exo
d1ddfd09b6 Update missing links in the documentation summary 2019-09-24 16:19:56 +02:00
Andrebcd4
40aa46e72a Sleep automatically on slow mode error too (#1279) 2019-09-24 11:37:41 +02:00
Lonami Exo
4f6e5c5f5a Remove another debug print, bump v1.10.4 2019-09-21 18:21:09 +02:00
penn5
8d5a7c6ffb Remove debugging print (#1276) 2019-09-21 17:54:45 +02:00
davtur19
b76bed3a40 Update errors' description (#1266) 2019-09-16 19:40:29 +02:00
Lonami
75ca28df49
Parse t.me/@<user> URLs as valid usernames 2019-09-16 11:36:35 +02:00
Lonami Exo
c1774276c2 Fix handling of ChannelForbidden in input peer, bump v1.10.3 2019-09-12 22:30:47 +02:00
Lonami Exo
9c06f29aaf Don't cache entities with min flag set, bump v1.10.2
Since layer 102, there are two access_hash. One with the min flag,
and one without it. This was causing channel invalid errors.

access_hash with min flag set can only be used to fetch files such
as profile pictures.

access_hash with min flag unset can be used under all circumstances.

Previously, the library did not distinguish between these, so it was
caching the hash that could hardly be used for anything.

With this change, only the "full" access_hash is stored, which will
work for any methods.

See also: https://core.telegram.org/api/min
2019-09-12 19:19:46 +02:00
Lonami Exo
5c72e1286e Let delete_dialog work for bot accounts without erroring 2019-09-10 21:38:46 +02:00
Lonami Exo
0bf4c4ae75 Add v1.10.1 to .nix files 2019-09-10 21:38:46 +02:00
davtur19
95ba02a9d3 Add new known errors (#1265) 2019-09-10 21:09:43 +02:00
Lonami Exo
47956ddbca Fix events.Album and minor docs nit, bump to v1.10.1 2019-09-09 19:21:03 +02:00
Lonami Exo
b4046017a7 Bump nix expressions to 1.10 2019-09-08 12:01:17 +02:00