diff options
author | David Robertson <davidr@element.io> | 2022-06-14 18:28:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 18:28:26 +0100 |
commit | c99b511db950bff5129e717a225de78b95b9b5ad (patch) | |
tree | dade8b69e8bf3abf52f1a6f7824f2aa08f79e280 /tests/rest/client/test_profile.py | |
parent | Up complement time outs (#13048) (diff) | |
download | synapse-c99b511db950bff5129e717a225de78b95b9b5ad.tar.xz |
Fix `destination_is` errors seen in sentry. (#13041)
* Rename test_fedclient to match its source file * Require at least one destination to be truthy * Explicitly validate user ID in profile endpoint GETs Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'tests/rest/client/test_profile.py')
-rw-r--r-- | tests/rest/client/test_profile.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/rest/client/test_profile.py b/tests/rest/client/test_profile.py index 77c3ced42e..29bed0e872 100644 --- a/tests/rest/client/test_profile.py +++ b/tests/rest/client/test_profile.py @@ -13,6 +13,8 @@ # limitations under the License. """Tests REST events for /profile paths.""" +import urllib.parse +from http import HTTPStatus from typing import Any, Dict, Optional from twisted.test.proto_helpers import MemoryReactor @@ -49,6 +51,12 @@ class ProfileTestCase(unittest.HomeserverTestCase): res = self._get_displayname() self.assertEqual(res, "owner") + def test_get_displayname_rejects_bad_username(self) -> None: + channel = self.make_request( + "GET", f"/profile/{urllib.parse.quote('@alice:')}/displayname" + ) + self.assertEqual(channel.code, HTTPStatus.BAD_REQUEST, channel.result) + def test_set_displayname(self) -> None: channel = self.make_request( "PUT", |