summary refs log tree commit diff
path: root/tests/test_utils/__init__.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | 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-211-10/+16
|
* Replace simple_async_mock with AsyncMock (#16180)Patrick Cloke2023-08-251-18/+1
| | | | Python 3.8 has a native AsyncMock, use it instead of a custom implementation.
* Replace make_awaitable with AsyncMock (#16179)Patrick Cloke2023-08-241-12/+0
| | | | Python 3.8 provides a native AsyncMock, we can replace the homegrown version we have.
* Handle errors when introspecting tokensQuentin Gliech2023-05-301-2/+2
| | | | | This returns a proper 503 when the introspection endpoint is not working for some reason, which should avoid logging out clients in those cases.
* Add more missing type hints to tests. (#15028)Patrick Cloke2023-02-081-9/+17
|
* Refactor OIDC tests to better mimic an actual OIDC provider. (#13910)Quentin Gliech2022-10-251-8/+32
| | | | | | | | | This implements a fake OIDC server, which intercepts calls to the HTTP client. Improves accuracy of tests by covering more internal methods. One particular example was the ID token validation, which previously mocked. This uncovered an incorrect dependency: Synapse actually requires at least authlib 0.15.1, not 0.14.0.
* Remove unused `# type: ignore`s (#12531)David Robertson2022-04-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | Over time we've begun to use newer versions of mypy, typeshed, stub packages---and of course we've improved our own annotations. This makes some type ignore comments no longer necessary. I have removed them. There was one exception: a module that imports `select.epoll`. The ignore is redundant on Linux, but I've kept it ignored for those of us who work on the source tree using not-Linux. (#11771) I'm more interested in the config line which enforces this. I want unused ignores to be reported, because I think it's useful feedback when annotating to know when you've fixed a problem you had to previously ignore. * Installing extras before typechecking Lacking an easy way to install all extras generically, let's bite the bullet and make install the hand-maintained `all` extra before typechecking. Now that https://github.com/matrix-org/backend-meta/pull/6 is merged to the release/v1 branch.
* Cache empty responses from `/user/devices` (#11587)David Robertson2022-01-051-2/+2
| | | If we've never made a request to a remote homeserver, we should cache the response---even if the response is "this user has no devices".
* Create a constant for a small png image in tests. (#10834)Patrick Cloke2021-09-161-2/+12
| | | To avoid duplicating it between a few tests.
* 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/+1
|
* Preparatory refactoring of the SamlHandlerTestCase (#8938)Richard van der Hoff2020-12-151-0/+12
| | | | | | | | | | | | | * move simple_async_mock to test_utils ... so that it can be re-used * Remove references to `SamlHandler._map_saml_response_to_user` from tests This method is going away, so we can no longer use it as a test point. Instead, factor out a higher-level method which takes a SAML object, and verify correct behaviour by mocking out `AuthHandler.complete_sso_login`. * changelog
* Factor out FakeResponse from test_oidcRichard van der Hoff2020-12-021-0/+27
|
* Fail test cases if they fail to await all awaitables (#8690)Patrick Cloke2020-10-301-1/+33
|
* Allow for make_awaitable's return value to be re-used. (#8261)Patrick Cloke2020-09-081-3/+10
|
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-1/+6
|
* Fix limit logic for EventsStream (#7358)Richard van der Hoff2020-04-291-0/+20
| | | | | | | | | | | | | | | | | | | * Factor out functions for injecting events into database I want to add some more flexibility to the tools for injecting events into the database, and I don't want to clutter up HomeserverTestCase with them, so let's factor them out to a new file. * Rework TestReplicationDataHandler This wasn't very easy to work with: the mock wrapping was largely superfluous, and it's useful to be able to inspect the received rows, and clear out the received list. * Fix AssertionErrors being thrown by EventsStream Part of the problem was that there was an off-by-one error in the assertion, but also the limit logic was too simple. Fix it all up and add some tests.
* Enable configuring test log level via env var (#4506)Richard van der Hoff2019-01-291-0/+18
I got fed up with always adding '@unittest.DEBUG' every time I needed to debug a test.