Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Test the endpoint does actually return 400
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Jun 14, 2022
1 parent a9ca641 commit ce3ad2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/rest/client/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

"""Tests REST events for /profile paths."""
from http import HTTPStatus
from typing import Any, Dict, Optional

from twisted.test.proto_helpers import MemoryReactor
Expand Down Expand Up @@ -49,6 +50,11 @@ def test_get_displayname(self) -> None:
res = self._get_displayname()
self.assertEqual(res, "owner")

def test_get_displayname_rejects_bad_username(self) -> None:
# Note: probably ought to urlencode the userid here, since it contains an `@`
channel = self.make_request("GET", "/profile/notanmxid@example.com/displayname")
self.assertEqual(channel.code, HTTPStatus.BAD_REQUEST, channel.result)

def test_set_displayname(self) -> None:
channel = self.make_request(
"PUT",
Expand Down

0 comments on commit ce3ad2e

Please sign in to comment.