summary refs log tree commit diff
path: root/tests/events (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Bring auto-accept invite logic into Synapse (#17147)devonh2024-05-211-0/+657
| | | | | | | | | | | | | | This PR ports the logic from the [synapse_auto_accept_invite](https://github.com/matrix-org/synapse-auto-accept-invite) module into synapse. I went with the naive approach of injecting the "module" next to where third party modules are currently loaded. If there is a better/preferred way to handle this, I'm all ears. It wasn't obvious to me if there was a better location to add this logic that would cleanly apply to all incoming invite events. Relies on https://github.com/element-hq/synapse/pull/17166 to fix linter errors.
* Removed `request_key` from the `SyncConfig` (moved outside as its own ↵Eric Eastwood2024-05-161-2/+15
| | | | | | | | | function parameter) (#17201) Removed `request_key` from the `SyncConfig` (moved outside as its own function parameter) so it doesn't have to flow into `_generate_sync_entry_for_xxx` methods. This way we can separate the concerns of caching from generating the response and reuse the `_generate_sync_entry_for_xxx` functions as we see fit. Plus caching doesn't really have anything to do with the config of sync. Split from https://github.com/element-hq/synapse/pull/17167 Spawning from https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279
* Refactor Sync handler to be able to return different sync responses ↵Eric Eastwood2024-05-161-2/+2
| | | | | | | | | | | | | | (`SyncVersion`) (#17200) Refactor Sync handler to be able to be able to return different sync responses (`SyncVersion`). Preparation to be able support sync v2 and a new Sliding Sync `/sync/e2ee` endpoint which returns a subset of sync v2. Split upon request: https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279 Split from https://github.com/element-hq/synapse/pull/17167 where we will add `SyncVersion.E2EE_SYNC` and a new type of sync response.
* Add support for MSC4115 (#17104)Richard van der Hoff2024-04-291-0/+24
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-233-0/+3
| | | | | 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-213-30/+48
|
* Replace simple_async_mock with AsyncMock (#16180)Patrick Cloke2023-08-251-3/+2
| | | | Python 3.8 has a native AsyncMock, use it instead of a custom implementation.
* Properly handle redactions of creation events (#15973)Shay2023-07-231-2/+7
|
* Support room version 11 (#15912)Patrick Cloke2023-07-181-16/+14
| | | | | And fix a bug in the implementation of the updated redaction format (MSC2174) where the top-level redacts field was not properly added for backwards-compatibility.
* Replace `EventContext` fields `prev_group` and `delta_ids` with field ↵Shay2023-06-131-2/+1
| | | | `state_group_deltas` (#15233)
* Properly parse event_fields in filters (#15607)Patrick Cloke2023-05-221-0/+39
| | | | | | | | The event_fields property in filters should use the proper escape rules, namely backslashes can be escaped with an additional backslash. This adds tests (adapted from matrix-js-sdk) and implements the logic to properly split the event_fields strings.
* Implement MSC3821 to update redaction rules (`third_party_invite.signed`) ↵Patrick Cloke2023-05-151-1/+74
| | | | | | (#15563) Updates the redaction rules to protect enough information that the event can still be properly verified.
* Implement MSC3389 to protect relations from redaction. (#15565)Patrick Cloke2023-05-151-0/+90
| | | | | | MSC3389 proposes protecting the relation type & parent event ID from redaction. This keeps the relation information intact after redaction which helps with some UX flaws (e.g. deleting an event causes it to no longer be in a thread, which is confusing).
* Implement MSC2174: move redacts to a content property. (#15395)Patrick Cloke2023-04-131-2/+10
| | | | | | | This moves `redacts` from being a top-level property to a `content` property in a new room version. MSC2176 (which was previously implemented) states to not `redact` this property.
* Implement MSC3989 to redact the origin field. (#15393)Patrick Cloke2023-04-051-0/+7
| | | | This will be done in a future room version, for now an unstable room version is added which redacts the origin field.
* Add final type hint to tests.unittest. (#15072)Patrick Cloke2023-02-141-7/+5
| | | | 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-3/+7
| | | | | | | | | | | | | * -> 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
* Properly typecheck tests.api (#14983)David Robertson2023-02-031-0/+2
|
* Add missing type hints for tests.events. (#14904)Patrick Cloke2023-01-253-61/+85
|
* Allow selecting "prejoin" events by state keys (#14642)David Robertson2022-12-131-5/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Declare new config * Parse new config * Read new config * Don't use trial/our TestCase where it's not needed Before: ``` $ time trial tests/events/test_utils.py > /dev/null real 0m2.277s user 0m2.186s sys 0m0.083s ``` After: ``` $ time trial tests/events/test_utils.py > /dev/null real 0m0.566s user 0m0.508s sys 0m0.056s ``` * Helper to upsert to event fields without exceeding size limits. * Use helper when adding invite/knock state Now that we allow admins to include events in prejoin room state with arbitrary state keys, be a good Matrix citizen and ensure they don't accidentally create an oversized event. * Changelog * Move StateFilter tests should have done this in #14668 * Add extra methods to StateFilter * Use StateFilter * Ensure test file enforces typed defs; alphabetise * Workaround surprising get_current_state_ids * Whoops, fix mypy
* Modernize unit tests configuration settings for workers. (#14568)realtyem2022-12-011-4/+12
| | | | Use the newer foo_instances configuration instead of the deprecated flags to enable specific features (e.g. start_pushers).
* Register homeserver modules when creating test homeserver (#13558)Andrew Morgan2022-08-191-4/+0
|
* Rename storage classes (#12913)Erik Johnston2022-05-311-2/+2
|
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-1/+1
| | | Instead of hard-coding strings in many places.
* Convert stringy power levels to integers on room upgrade (#12657)David Robertson2022-05-071-2/+39
|
* Use the proper serialization format when bundling aggregations. (#12090)Patrick Cloke2022-03-031-1/+4
| | | | This ensures that the `latest_event` field of the bundled aggregation for threads uses the same format as the other events in the response.
* Replace assertEquals and friends with non-deprecated versions. (#12092)Patrick Cloke2022-02-281-8/+8
|
* 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
* Strip "join_authorised_via_users_server" from join events which do not need ↵Patrick Cloke2021-09-301-3/+4
| | | | | | | it. (#10933) This fixes a "Event not signed by authorising server" error when transition room member from join -> join, e.g. when updating a display name or avatar URL for restricted rooms.
* 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.
* Support MSC3375: room version 9. (#10747)Patrick Cloke2021-09-031-1/+45
|
* Port the PresenceRouter module interface to the new generic interface (#10524)Azrenbeth2021-08-171-5/+104
| | | Port the PresenceRouter module interface to the new generic interface introduced in v1.37.0
* Flatten the synapse.rest.client package (#10600)reivilibre2021-08-172-2/+2
|
* Support MSC3289: Room version 8 (#10449)Patrick Cloke2021-08-091-1/+1
| | | This adds support for MSC3289: room version 8. This is room version 7 + MSC3083.
* Restricted rooms (MSC3083) should not have their allow key redacted. (#10489)Patrick Cloke2021-07-281-0/+43
|
* Stagger send presence to remotes (#10398)Erik Johnston2021-07-151-0/+8
| | | | | | This is to help with performance, where trying to connect to thousands of hosts at once can consume a lot of CPU (due to TLS etc). Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Use inline type hints in `tests/` (#10350)Jonathan de Jong2021-07-131-3/+3
| | | | | | | | 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-4/+11
| | | | to them, instead of something in-memory (#9823)
* 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-091-3/+3
|
* Add a Synapse Module for configuring presence update routing (#9491)Andrew Morgan2021-04-061-0/+386
| | | | | | | | | | | | 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
* Implement MSC2176: Updated redaction rules (#8984)Patrick Cloke2021-01-051-21/+164
| | | | An experimental room version ("org.matrix.msc2176") contains the new redaction rules for testing.
* Convert the message handler to async/await. (#7884)Patrick Cloke2020-07-221-15/+21
|
* Implement room version 6 (MSC2240). (#7506)Patrick Cloke2020-05-151-1/+1
|
* Fix bug in EventContext.deserialize. (#7393)Erik Johnston2020-05-051-0/+100
| | | | This caused `prev_state_ids` to be incorrect if the state event was not replacing an existing state entry.
* Remove special auth and redaction rules for aliases events in experimental ↵Patrick Cloke2020-03-091-2/+33
| | | | room ver. (#7037)
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-4/+5
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Factor out a `copy_power_levels_contents` methodRichard van der Hoff2020-01-291-2/+43
| | | | I'm going to need another copy (hah!) of this.
* Run Black. (#5482)Amber Brown2019-06-201-47/+47
|
* Fix a number of flake8 errorsRichard van der Hoff2018-10-241-2/+2
| | | | | | | | | | | | Broadly three things here: * disable W504 which seems a bit whacko * remove a bunch of `as e` expressions from exception handlers that don't use them * use `r""` for strings which include backslashes Also, we don't use pep8 any more, so we can get rid of the duplicate config there.
* Run black.black2018-08-101-98/+37
|
* run isortAmber Brown2018-07-091-2/+2
|
* Optimise state resolutionErik Johnston2017-01-171-1/+21
|
* Review commentsKegan Dougal2016-11-221-10/+2
|
* More testsKegan Dougal2016-11-221-1/+56
|
* Add remaining testsKegan Dougal2016-11-211-4/+70
|
* Start adding some testsKegan Dougal2016-11-211-3/+37
|
* Move event_fields filtering to serialize_eventKegan Dougal2016-11-211-0/+21
| | | | Also make it an inclusive not exclusive filter, as the spec demands.
* Fix flake8 warnings for testsMark Haines2016-02-191-0/+1
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Add some unit tests of prune_events()Paul "LeoNerd" Evans2015-10-162-0/+115
|
* Kill off synapse.api.events.*Erik Johnston2014-12-162-232/+0
|
* Fix validation testsErik Johnston2014-11-111-12/+43
|
* Have all unit tests import from our own subclass of trial's unittest ↵Paul "LeoNerd" Evans2014-09-121-1/+1
| | | | TestCase; set up logging in ONE PLACE ONLY
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-032-2/+2
| | | | hasn't been incorporated in time for launch.
* add in copyrights to everything, not just the synapse subdir, and add a ↵Matthew Hodgson2014-08-132-0/+28
| | | | copyrighter.pl whilst we're at it
* Reference Matrix Home Servermatrix.org2014-08-122-0/+173