summary refs log tree commit diff
path: root/tests/appservice (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Recover an appservice if a successful ping occurs. (#18521)Will Hunt2025-06-061-1/+36
| | | | | | | | | | | | | | Fixes https://github.com/element-hq/synapse/issues/14240 This scratches an itch that i've had for years. We regularly run into the issue where (especially in development) appservices can go down for a period and them come back up. The ping endpoint was introduced some time ago which means Synapse can determine if an AS is up more or less immediately, so we might as well use that to schedule transaction redelivery. I believe transaction scheduling logic is largely implementation specific, so we should be in the clear to do this without any spec changes.
* Format files with Ruff (#17643)Quentin Gliech2024-09-021-1/+2
| | | | | | I thought ruff check would also format, but it doesn't. This runs ruff format in CI and dev scripts. The first commit is just a run of `ruff format .` in the root directory.
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-234-0/+4
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Update license headersPatrick Cloke2023-11-214-40/+64
|
* Send the opentracing span information to appservices (#16227)Marcel2023-09-061-6/+12
|
* Bump mypy-zope & mypy. (#16188)Patrick Cloke2023-08-291-3/+3
|
* Replace simple_async_mock with AsyncMock (#16180)Patrick Cloke2023-08-252-35/+39
| | | | Python 3.8 has a native AsyncMock, use it instead of a custom implementation.
* Move support for application service query parameter authorization behind a ↵Shay2023-08-031-4/+81
| | | | configuration option (#16017)
* Remove support for legacy application service paths (#15964)Shay2023-07-261-53/+0
|
* Improve type hints for cached decorator. (#15658)Patrick Cloke2023-05-241-53/+29
| | | | | The cached decorators always return a Deferred, which was not properly propagated. It was close enough when wrapping coroutines, but failed if a bare function was wrapped.
* Add support for claiming multiple OTKs at once. (#15468)Patrick Cloke2023-04-271-6/+5
| | | | | | | MSC3983 provides a way to request multiple OTKs at once from appservices, this extends this concept to the Client-Server API. Note that this will likely be spit out into a separate MSC, but is currently part of MSC3983.
* Call appservices on modern paths, falling back to legacy paths. (#15317)Patrick Cloke2023-04-031-2/+55
| | | | | This uses the specced /_matrix/app/v1/... paths instead of the "legacy" paths. If the homeserver receives an error it will retry using the legacy path.
* Implement MSC3983 to proxy /keys/claim queries to appservices. (#15314)Patrick Cloke2023-03-281-0/+59
| | | | | | Experimental support for MSC3983 is behind a configuration flag. If enabled, for users which are exclusively owned by an application service then the appservice will be queried for one-time keys *if* there are none uploaded to Synapse.
* Fix-up type hints in tests/server.py. (#15084)Patrick Cloke2023-02-171-4/+2
| | | | | This file was being ignored by mypy, we remove that and add the missing type hints & deal with any fallout.
* Type hints for tests.appservice (#14990)David Robertson2023-02-063-51/+100
| | | | | | | | | | | | | | | | | | | | * Accept a Sequence of events in synapse.appservice This avoids some casts/ignores in the tests I'm about to fixup. It seems that `List[Mock]` is not a subtype of `List[EventBase]`, but `Sequence[Mock]` is a subtype of `Sequence[EventBase]`. So presumably `Mock` is considered a subtype of anything, much like `Any`. * make tests.appservice.test_scheduler pass mypy * Extra hints in tests.appservice.test_scheduler * Extra hints in tests.appservice.test_api * Extra hints in tests.appservice.test_appservice * Disallow untyped defs * Changelog
* Use `device_one_time_keys_count` to match MSC3202 (#14565)Andrew Ferrazzutti2022-11-281-3/+3
| | | | | | | | | | | | | | | | | | | * Use `device_one_time_keys_count` to match MSC3202 Rename the `device_one_time_key_counts` key in responses to `device_one_time_keys_count` to match the name specified by MSC3202. Also change related variable/class names for consistency. Signed-off-by: Andrew Ferrazzutti <andrewf@element.io> * Update changelog.d/14565.misc * Revert name change for `one_time_key_counts` key as this is a different key altogether from `device_one_time_keys_count`, which is used for `/sync` instead of appservice transactions. Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
* Merge branch 'master' into developOlivier Wilkinson (reivilibre)2022-10-281-3/+5
|\
| * Fix incorrectly sending authentication tokens to application service as ↵David Robertson2022-10-261-3/+5
| | | | | | | | headers (#14301)
* | Check appservice user interest against the local users instead of all users ↵Eric Eastwood2022-10-271-5/+5
|/ | | | (`get_users_in_room` mis-use) (#13958)
* Send the appservice access token as a header. (#13996)Patrick Cloke2022-10-041-2/+6
| | | | | | | | | Implements MSC2832 by sending application service access tokens in the Authorization header. The access token is also still sent as a query parameter until the application service ecosystem has fully migrated to using headers. In the future this could be made opt-in, or removed completely.
* Remove remaining bits of groups code. (#12936)Patrick Cloke2022-06-012-2/+0
| | | | | | * Update worker docs to remove group endpoints. * Removes an unused parameter to `ApplicationService`. * Break dependency between media repo and groups. * Avoid copying `m.room.related_groups` state events during room upgrades.
* Remove backing code for groups/communities (#12558)Patrick Cloke2022-05-261-1/+1
| | | | Including handlers, configuration code, appservice support, and the GroupID construct.
* Add authentication to thirdparty bridge APIs (#12746)Will Hunt2022-05-241-0/+102
| | | Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Send device list updates to application services (MSC3202) - part 1 (#11881)Andrew Morgan2022-03-301-15/+39
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Rename various ApplicationServices interested methods (#11915)Andrew Morgan2022-03-031-11/+34
|
* Replace assertEquals and friends with non-deprecated versions. (#12092)Patrick Cloke2022-02-281-31/+31
|
* Add support for MSC3202: sending one-time key counts and fallback key usage ↵reivilibre2022-02-241-16/+39
| | | | | states to Application Services. (#11617) Co-authored-by: Erik Johnston <erik@matrix.org>
* Remove optional state of `ApplicationService.is_interested`'s `store` ↵Andrew Morgan2022-02-071-6/+32
| | | | parameter (#11911)
* Convert `ApplicationServiceTestCase` to use `simple_async_mock` (#11880)Andrew Morgan2022-02-011-10/+9
|
* Send to-device messages to application services (#11215)Andrew Morgan2022-02-011-48/+61
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add missing type hints to `synapse.appservice` (#11360)Patrick Cloke2021-12-141-8/+3
|
* Fix errors in Synapse logs from unit tests. (#10939)Patrick Cloke2021-09-301-21/+19
| | | | | Fix some harmless errors from background processes (mostly due to awaiting Mock objects) that occurred in the Synapse logs during unit tests.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-143-3/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-092-3/+2
|
* Add ability for access tokens to belong to one user but grant access to ↵Erik Johnston2020-10-291-0/+1
| | | | | | | | | | another user. (#8616) We do it this way round so that only the "owner" can delete the access token (i.e. `/logout/all` by the "owner" also deletes that token, but `/logout/all` by the "target user" doesn't). A future PR will add an API for creating such a token. When the target user and authenticated entity are different the `Processed request` log line will be logged with a: `{@admin:server as @bob:server} ...`. I'm not convinced by that format (especially since it adds spaces in there, making it harder to use `cut -d ' '` to chop off the start of log lines). Suggestions welcome.
* Limit AS transactions to 100 events (#8606)Will Hunt2020-10-211-0/+41
| | | | | | | | | | | | | * Limit AS transactions to 100 events * Update changelog.d/8606.feature Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Add tests * Update synapse/appservice/scheduler.py Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Send some ephemeral events to appservices (#8437)Will Hunt2020-10-151-19/+58
| | | Optionally sends typing, presence, and read receipt information to appservices.
* Convert appservice to async. (#7973)Patrick Cloke2020-07-302-36/+72
|
* Refactor the Appservice scheduler codeRichard van der Hoff2019-08-201-4/+2
| | | | | | | | Get rid of the labyrinthine `recoverer_fn` code, and clean up the startup code (it seemed to be previously inexplicably split between `ApplicationServiceScheduler.start` and `_Recoverer.start`). Add some docstrings too.
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Run black.black2018-08-102-77/+37
|
* run isortAmber Brown2018-07-092-9/+15
|
* Fix a couple of logcontext leaks in unit testsRichard van der Hoff2018-05-021-2/+9
| | | | | | ... which were making other, innocent, tests, fail. Plus remove a spurious unittest.DEBUG which was making the output noisy.
* Add extra space before inline commentLuke Barnard2017-11-161-1/+1
|
* Fix testsLuke Barnard2017-11-161-0/+1
|
* Compile the regex's used in ASesErik Johnston2017-03-281-1/+3
|
* Make notify_interested_services fasterErik Johnston2016-08-171-65/+44
|
* Clean up _ServiceQueuerErik Johnston2016-08-171-1/+1
|
* Fix flake8 warnings for testsMark Haines2016-02-192-3/+3
|
* Require ID and as_token be unique for ASsDaniel Wagner-Hall2016-01-141-0/+1
| | | | | Defaults ID to as_token if not specified. This will change when IDs are fully supported.
* copyrightsMatthew Hodgson2016-01-073-3/+3
|
* Make the appservice use 'users_in_room' rather than get_room_members since ↵Mark Haines2015-05-221-12/+3
| | | | it is cached
* Fix thinko whereby events *for the AS specifically* were not passed on.Kegan Dougal2015-03-311-0/+13
| | | | | This was caused by not explicitly checking the service.sender field. This has now been fixed and a regression test has been added.
* Implement ServiceQueuer with tests.Kegan Dougal2015-03-161-7/+47
|
* Replace EventGrouper for ServiceQueuer to move to push-based txns. Fix tests ↵Kegan Dougal2015-03-161-73/+27
| | | | and add stub tests for ServiceQueuer.
* Minor PR comment tweaks.Kegan Dougal2015-03-161-5/+5
|
* Use seconds; start gluing in the AS scheduler into the AS handler.Kegan Dougal2015-03-091-5/+5
|
* Update UTsKegan Dougal2015-03-061-5/+5
|
* Apply clarity and docstringsKegan Dougal2015-03-061-1/+1
|
* Finish synapse.appservice.scheduler implementation.Kegan Dougal2015-03-061-2/+113
| | | | | With tests to assert behaviour. Not hooked up yet. Stub datastore methods not implemented yet.
* Flesh out more stub functions.Kegan Dougal2015-03-061-2/+3
|
* Add more tests; fix bugs.Kegan Dougal2015-03-061-7/+47
|
* Start adding some testsKegan Dougal2015-03-061-0/+106
|
* Add more unit tests for exclusive namespaces.Kegan Dougal2015-02-271-1/+49
|
* Update unit tests to use new format.Kegan Dougal2015-02-271-16/+23
|
* Notify ASes for events sent by other users in a room which an AS user is a ↵Kegan Dougal2015-02-111-0/+25
| | | | part of.
* Fix bug in store defer. Add more unit tests.Kegan Dougal2015-02-041-0/+87
|
* Begin to add unit tests for appservice glue and regex testing.Kegan Dougal2015-02-042-0/+72