summary refs log tree commit diff
path: root/tests/module_api/test_api.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Convert user_get_threepids response to attrs. (#16468)Patrick Cloke2023-10-111-4/+4
| | | This improves type annotations by not having a dictionary of Any values.
* Bump mypy-zope & mypy. (#16188)Patrick Cloke2023-08-291-2/+2
|
* Replace simple_async_mock with AsyncMock (#16180)Patrick Cloke2023-08-251-6/+3
| | | | Python 3.8 has a native AsyncMock, use it instead of a custom implementation.
* Run pyupgrade for python 3.7 & 3.8. (#16110)Patrick Cloke2023-08-151-1/+1
|
* `N + 3`: Read from column `full_user_id` rather than `user_id` of tables ↵Shay2023-06-021-2/+4
| | | | `profiles` and `user_filters` (#15649)
* Remove `worker_replication_*` settings (#15491)Jason Little2023-05-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add master to the instance_map as part of Complement, have ReplicationEndpoint look at instance_map for master. * Fix typo in drive by. * Remove unnecessary worker_replication_* bits from unit tests and add master to instance_map(hopefully in the right place) * Several updates: 1. Switch from master to main for naming the main process in the instance_map. Add useful constants for easier adjustment of names in the future. 2. Add backwards compatibility for worker_replication_* to allow time to transition to new style. Make sure to prioritize declaring main directly on the instance_map. 3. Clean up old comments/commented out code. 4. Adjust unit tests to match with new code. 5. Adjust Complement setup infrastructure to only add main to the instance_map if workers are used and remove now unused options from the worker.yaml template. * Initial Docs upload * Changelog * Missed some commented out code that can go now * Remove TODO comment that no longer holds true. * Fix links in docs * More docs * Remove debug logging * Apply suggestions from code review Co-authored-by: reivilibre <olivier@librepush.net> * Apply suggestions from code review Co-authored-by: reivilibre <olivier@librepush.net> * Update version to latest, include completeish before/after examples in upgrade notes. * Fix up and docs too --------- Co-authored-by: reivilibre <olivier@librepush.net>
* Delete pushers after calling on_logged_out module hook on device delete (#15410)Mathieu Velten2023-04-141-1/+50
|
* Add final type hint to tests.unittest. (#15072)Patrick Cloke2023-02-141-8/+6
| | | | Adds a return type to HomeServerTestCase.make_homeserver and deal with any variables which are no longer Any.
* Proper types for `tests.module_api` (#15031)David Robertson2023-02-091-50/+72
| | | | | | | | | | | | | * -> None for test methods * A first batch of type fixes * Introduce common parent test case * Fixup that big test method * tests.module_api passes mypy * Changelog
* Always notify replication when a stream advances (#14877)Erik Johnston2023-01-201-0/+3
| | | This ensures that all other workers are told about stream updates in a timely manner, without having to remember to manually poke replication.
* Add `set_displayname` to the module API (#14629)Emelie Graven2023-01-111-0/+18
|
* Modernize unit tests configuration settings for workers. (#14568)realtyem2022-12-011-1/+2
| | | | Use the newer foo_instances configuration instead of the deprecated flags to enable specific features (e.g. start_pushers).
* Fix an invalid comparison of `UserPresenceState` to `str` (#14393)Andrew Morgan2022-11-161-0/+3
|
* Reduce the number of tests using TCP replication. (#13543)Patrick Cloke2022-08-191-7/+0
| | | | Uses Redis replication in additional test cases (instead of TCP replication). A small step towards dropping TCP replication.
* Update module API "update room membership" method to allow for remote joins ↵Matt C2022-08-051-0/+29
| | | | | | (#13441) Co-authored-by: MattC <buffless-matt@users.noreply.github.com> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Add module API method to create a room (#13429)Matt C2022-08-041-0/+51
| | | | Co-authored-by: MattC <buffless-matt@users.noreply.github.com> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Add module API method to resolve a room alias to a room ID (#13428)Matt C2022-08-031-0/+19
| | | | Co-authored-by: MattC <buffless-matt@users.noreply.github.com> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-1/+1
| | | Instead of hard-coding strings in many places.
* Add a module API to allow modules to edit push rule actions (#12406)Brendan Abolivier2022-04-271-1/+83
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove redundant `get_success` calls in test code (#12346)Richard van der Hoff2022-04-011-11/+9
| | | There are a bunch of places we call get_success on an immediate value, which is unnecessary. Let's rip them out, and remove the redundant functionality in get_success and friends.
* Default to `private` room visibility rather than `public` when a client does ↵reivilibre2022-04-011-1/+1
| | | | not specify one, according to spec. (#12350)
* Add set_user_admin function to the module API (#12341)Amanda Graven2022-04-011-0/+14
|
* Allow registering admin users using the module API (#12250)Nicolas Werner2022-03-231-0/+10
| | | Signed-off-by: Nicolas Werner <n.werner@famedly.com>
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Remove a debug statement from tests. (#11239)Patrick Cloke2021-11-031-1/+0
|
* Add a module API method to retrieve state from a room (#11204)Brendan Abolivier2021-10-291-1/+24
|
* Add a ModuleApi method to update a user's membership in a room (#11147)Brendan Abolivier2021-10-281-1/+125
| | | Co-authored-by: reivilibre <oliverw@matrix.org>
* Fix errors in Synapse logs from unit tests. (#10939)Patrick Cloke2021-09-301-1/+6
| | | | | Fix some harmless errors from background processes (mostly due to awaiting Mock objects) that occurred in the Synapse logs during unit tests.
* Extend ModuleApi with the methods we'll need to reject spam based on …IP - ↵David Teller2021-09-221-0/+72
| | | | | | | | resolves #10832 (#10833) Extend ModuleApi with the methods we'll need to reject spam based on IP - resolves #10832 Signed-off-by: David Teller <davidt@element.io>
* Flatten the synapse.rest.client package (#10600)reivilibre2021-08-171-1/+1
|
* Add `get_userinfo_by_id` method to `ModuleApi` (#9581)Jason Robinson2021-08-041-0/+10
| | | | | | Makes it easier to fetch user details in for example spam checker modules, without needing to use api._store or figure out database interactions. Signed-off-by: Jason Robinson <jasonr@matrix.org>
* Use inline type hints in `tests/` (#10350)Jonathan de Jong2021-07-131-8/+8
| | | | | | | | This PR is tantamount to running: python3.8 -m com2ann -v 6 tests/ (com2ann requires python 3.8 to run)
* Use a database table to hold the users that should have full presence sent ↵Andrew Morgan2021-05-181-87/+216
| | | | to them, instead of something in-memory (#9823)
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+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-091-2/+3
|
* Add a Synapse Module for configuring presence update routing (#9491)Andrew Morgan2021-04-061-3/+172
| | | | | | | | | | | | At the moment, if you'd like to share presence between local or remote users, those users must be sharing a room together. This isn't always the most convenient or useful situation though. This PR adds a module to Synapse that will allow deployments to set up extra logic on where presence updates should be routed. The module must implement two methods, `get_users_for_states` and `get_interested_users`. These methods are given presence updates or user IDs and must return information that Synapse will use to grant passing presence updates around. A method is additionally added to `ModuleApi` which allows triggering a set of users to receive the current, online presence information for all users they are considered interested in. This is the equivalent of that user receiving presence information during an initial sync. The goal of this module is to be fairly generic and useful for a variety of applications, with hard requirements being: * Sending state for a specific set or all known users to a defined set of local and remote users. * The ability to trigger an initial sync for specific users, so they receive all current state.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-1/+4
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-5/+6
|
* Allow modules to create and send events into rooms (#8479)Andrew Morgan2020-10-091-0/+95
| | | | | This PR allows Synapse modules making use of the `ModuleApi` to create and send non-membership events into a room. This can useful to have modules send messages, or change power levels in a room etc. Note that they must send event through a user that's already in the room. The non-membership event limitation is currently arbitrary, as it's another chunk of work and not necessary at the moment.
* Combine `SpamCheckerApi` with the more generic `ModuleApi`. (#8464)Richard van der Hoff2020-10-071-2/+2
| | | | | Lots of different module apis is not easy to maintain. Rather than adding yet another ModuleApi(hs, hs.get_auth_handler()) incantation, first add an hs.get_module_api() method and use it where possible.
* Allow ThirdPartyEventRules modules to manipulate public room state (#8292)Andrew Morgan2020-10-051-1/+55
| | | | | This PR allows `ThirdPartyEventRules` modules to view, manipulate and block changes to the state of whether a room is published in the public rooms directory. While the idea of whether a room is in the public rooms list is not kept within an event in the room, `ThirdPartyEventRules` generally deal with controlling which modifications can happen to a room. Public rooms fits within that idea, even if its toggle state isn't controlled through a state event.
* Convert simple_select_one and simple_select_one_onecol to async (#8162)Patrick Cloke2020-08-261-1/+1
|
* Wrap register_device coroutine in an ensureDeferred (#7684)Andrew Morgan2020-06-161-0/+54
Fixes https://github.com/matrix-org/synapse/issues/7683 Broke in: #7649 We had a `yield` acting on a coroutine. To be fair this one is a bit difficult to notice as there's a function in the middle that just passes the coroutine along.