mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
api: Fix encoding of strings in hotspot endpoint.
* Remove unnecessary json_validator for string parameter. * Update frontend to pass right parameters. Fixes part of #18035.
This commit is contained in:
committed by
Tim Abbott
parent
7563e3692c
commit
d6cf1ef27b
@@ -1,5 +1,3 @@
|
||||
import orjson
|
||||
|
||||
from zerver.lib.actions import do_create_user, do_mark_hotspot_as_read
|
||||
from zerver.lib.hotspots import ALL_HOTSPOTS, INTRO_HOTSPOTS, get_next_hotspots
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
@@ -56,18 +54,14 @@ class TestHotspots(ZulipTestCase):
|
||||
def test_hotspots_url_endpoint(self) -> None:
|
||||
user = self.example_user("hamlet")
|
||||
self.login_user(user)
|
||||
result = self.client_post(
|
||||
"/json/users/me/hotspots", {"hotspot": orjson.dumps("intro_reply").decode()}
|
||||
)
|
||||
result = self.client_post("/json/users/me/hotspots", {"hotspot": "intro_reply"})
|
||||
self.assert_json_success(result)
|
||||
self.assertEqual(
|
||||
list(UserHotspot.objects.filter(user=user).values_list("hotspot", flat=True)),
|
||||
["intro_reply"],
|
||||
)
|
||||
|
||||
result = self.client_post(
|
||||
"/json/users/me/hotspots", {"hotspot": orjson.dumps("invalid").decode()}
|
||||
)
|
||||
result = self.client_post("/json/users/me/hotspots", {"hotspot": "invalid"})
|
||||
self.assert_json_error(result, "Unknown hotspot: invalid")
|
||||
self.assertEqual(
|
||||
list(UserHotspot.objects.filter(user=user).values_list("hotspot", flat=True)),
|
||||
|
||||
Reference in New Issue
Block a user