2016-05-08 15:20:51 +02:00
|
|
|
# -*- coding: utf-8 -*-AA
|
2014-02-07 23:10:14 +01:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2016-06-03 07:59:00 +02:00
|
|
|
from typing import Any, Dict, List
|
|
|
|
|
2014-02-07 23:10:14 +01:00
|
|
|
from zerver.models import (
|
2017-05-23 23:11:29 +02:00
|
|
|
get_user, Recipient, UserMessage
|
2014-02-07 23:10:14 +01:00
|
|
|
)
|
|
|
|
|
2016-11-10 19:30:09 +01:00
|
|
|
from zerver.lib.test_helpers import tornado_redirected_to_list
|
|
|
|
from zerver.lib.test_classes import (
|
|
|
|
ZulipTestCase,
|
|
|
|
)
|
2014-02-07 23:10:14 +01:00
|
|
|
import ujson
|
|
|
|
|
2016-08-23 02:08:42 +02:00
|
|
|
class PointerTest(ZulipTestCase):
|
2014-02-07 23:10:14 +01:00
|
|
|
|
|
|
|
def test_update_pointer(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2014-02-07 23:10:14 +01:00
|
|
|
"""
|
|
|
|
Posting a pointer to /update (in the form {"pointer": pointer}) changes
|
|
|
|
the pointer we store for your UserProfile.
|
|
|
|
"""
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2017-05-25 02:08:35 +02:00
|
|
|
msg_id = self.send_message(self.example_email("othello"), "Verona", Recipient.STREAM)
|
2016-12-31 08:54:00 +01:00
|
|
|
result = self.client_post("/json/users/me/pointer", {"pointer": msg_id})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_success(result)
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, msg_id)
|
2014-02-07 23:10:14 +01:00
|
|
|
|
|
|
|
def test_api_update_pointer(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2014-02-07 23:10:14 +01:00
|
|
|
"""
|
|
|
|
Same as above, but for the API view
|
|
|
|
"""
|
2017-05-08 16:23:43 +02:00
|
|
|
user = self.example_user('hamlet')
|
|
|
|
email = user.email
|
|
|
|
self.assertEqual(user.pointer, -1)
|
2017-05-25 02:08:35 +02:00
|
|
|
msg_id = self.send_message(self.example_email("othello"), "Verona", Recipient.STREAM)
|
2016-12-31 08:54:00 +01:00
|
|
|
result = self.client_post("/api/v1/users/me/pointer", {"pointer": msg_id},
|
|
|
|
**self.api_auth(email))
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_success(result)
|
2017-05-23 23:11:29 +02:00
|
|
|
self.assertEqual(get_user(email, user.realm).pointer, msg_id)
|
2014-02-07 23:10:14 +01:00
|
|
|
|
|
|
|
def test_missing_pointer(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2014-02-07 23:10:14 +01:00
|
|
|
"""
|
2016-04-02 20:24:19 +02:00
|
|
|
Posting json to /json/users/me/pointer which does not contain a pointer key/value pair
|
2014-02-07 23:10:14 +01:00
|
|
|
returns a 400 and error message.
|
|
|
|
"""
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2016-12-31 08:54:00 +01:00
|
|
|
result = self.client_post("/json/users/me/pointer", {"foo": 1})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_error(result, "Missing 'pointer' argument")
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2014-02-07 23:10:14 +01:00
|
|
|
|
|
|
|
def test_invalid_pointer(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2014-02-07 23:10:14 +01:00
|
|
|
"""
|
2016-04-02 20:24:19 +02:00
|
|
|
Posting json to /json/users/me/pointer with an invalid pointer returns a 400 and error
|
2014-02-07 23:10:14 +01:00
|
|
|
message.
|
|
|
|
"""
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2016-12-31 08:54:00 +01:00
|
|
|
result = self.client_post("/json/users/me/pointer", {"pointer": "foo"})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_error(result, "Bad value for 'pointer': foo")
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2014-02-07 23:10:14 +01:00
|
|
|
|
|
|
|
def test_pointer_out_of_range(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2014-02-07 23:10:14 +01:00
|
|
|
"""
|
2016-04-02 20:24:19 +02:00
|
|
|
Posting json to /json/users/me/pointer with an out of range (< 0) pointer returns a 400
|
2014-02-07 23:10:14 +01:00
|
|
|
and error message.
|
|
|
|
"""
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2016-12-31 08:54:00 +01:00
|
|
|
result = self.client_post("/json/users/me/pointer", {"pointer": -2})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_error(result, "Bad value for 'pointer': -2")
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2014-02-07 23:10:14 +01:00
|
|
|
|
2017-03-19 01:46:39 +01:00
|
|
|
def test_use_first_unread_anchor_interaction_with_pointer(self):
|
|
|
|
# type: () -> None
|
|
|
|
"""
|
|
|
|
Getting old messages (a get request to /json/messages) should never
|
|
|
|
return an unread message older than the current pointer, when there's
|
|
|
|
no narrow set.
|
|
|
|
"""
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-03-19 01:46:39 +01:00
|
|
|
# Ensure the pointer is not set (-1)
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer, -1)
|
2017-03-19 01:46:39 +01:00
|
|
|
# Mark all existing messages as read
|
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
|
|
|
"op": "add",
|
|
|
|
"flag": "read",
|
|
|
|
"all": ujson.dumps(True)})
|
|
|
|
self.assert_json_success(result)
|
|
|
|
|
|
|
|
# Send a new message (this will be unread)
|
2017-05-25 02:08:35 +02:00
|
|
|
new_message_id = self.send_message(self.example_email("othello"), "Verona",
|
2017-03-19 01:46:39 +01:00
|
|
|
Recipient.STREAM, "test")
|
|
|
|
|
|
|
|
# If we call get_messages with use_first_unread_anchor=True, we
|
|
|
|
# should get the message we just sent
|
|
|
|
messages = self.get_messages(
|
|
|
|
anchor=0, num_before=0, num_after=1, use_first_unread_anchor=True)
|
|
|
|
self.assertEqual(messages[0]['id'], new_message_id)
|
|
|
|
|
|
|
|
# We want to get the message_id of an arbitrar old message. We can
|
|
|
|
# call get_messages with use_first_unread_anchor=False and simply
|
|
|
|
# save the first message we're returned.
|
|
|
|
messages = self.get_messages(
|
|
|
|
anchor=0, num_before=0, num_after=2, use_first_unread_anchor=False)
|
|
|
|
old_message_id = messages[0]['id']
|
|
|
|
next_old_message_id = messages[1]['id']
|
|
|
|
|
|
|
|
# Verify the message is marked as read
|
|
|
|
user_message = UserMessage.objects.get(
|
|
|
|
message_id=old_message_id,
|
2017-05-07 17:21:26 +02:00
|
|
|
user_profile=self.example_user('hamlet'))
|
2017-03-19 01:46:39 +01:00
|
|
|
self.assertTrue(user_message.flags.read)
|
|
|
|
|
|
|
|
# Let's set this old message to be unread
|
|
|
|
result = self.client_post("/json/messages/flags",
|
|
|
|
{"messages": ujson.dumps([old_message_id]),
|
|
|
|
"op": "remove",
|
|
|
|
"flag": "read"})
|
|
|
|
|
|
|
|
# Verify it's now marked as unread
|
|
|
|
user_message = UserMessage.objects.get(
|
|
|
|
message_id=old_message_id,
|
2017-05-07 17:21:26 +02:00
|
|
|
user_profile=self.example_user('hamlet'))
|
2017-03-19 01:46:39 +01:00
|
|
|
self.assert_json_success(result)
|
|
|
|
self.assertFalse(user_message.flags.read)
|
|
|
|
|
|
|
|
# Now if we call get_messages with use_first_unread_anchor=True,
|
|
|
|
# we should get the old message we just set to unread
|
|
|
|
messages = self.get_messages(
|
|
|
|
anchor=0, num_before=0, num_after=1, use_first_unread_anchor=True)
|
|
|
|
self.assertEqual(messages[0]['id'], old_message_id)
|
|
|
|
|
|
|
|
# Let's update the pointer to be *after* this old unread message (but
|
|
|
|
# still on or before the new unread message we just sent)
|
|
|
|
result = self.client_post("/json/users/me/pointer",
|
|
|
|
{"pointer": next_old_message_id})
|
|
|
|
self.assert_json_success(result)
|
2017-05-07 17:21:26 +02:00
|
|
|
self.assertEqual(self.example_user('hamlet').pointer,
|
2017-03-19 01:46:39 +01:00
|
|
|
next_old_message_id)
|
|
|
|
|
|
|
|
# Verify that moving the pointer didn't mark our message as read.
|
|
|
|
user_message = UserMessage.objects.get(
|
|
|
|
message_id=old_message_id,
|
2017-05-07 17:21:26 +02:00
|
|
|
user_profile=self.example_user('hamlet'))
|
2017-03-19 01:46:39 +01:00
|
|
|
self.assertFalse(user_message.flags.read)
|
|
|
|
|
|
|
|
# Now if we call get_messages with use_first_unread_anchor=True,
|
|
|
|
# we should not get the old unread message (because it's before the
|
|
|
|
# pointer), and instead should get the newly sent unread message
|
|
|
|
messages = self.get_messages(
|
|
|
|
anchor=0, num_before=0, num_after=1, use_first_unread_anchor=True)
|
|
|
|
self.assertEqual(messages[0]['id'], new_message_id)
|
|
|
|
|
2016-08-23 02:08:42 +02:00
|
|
|
class UnreadCountTests(ZulipTestCase):
|
2014-02-07 23:10:14 +01:00
|
|
|
def setUp(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-01-24 07:06:13 +01:00
|
|
|
self.unread_msg_ids = [
|
|
|
|
self.send_message(
|
2017-05-25 01:44:04 +02:00
|
|
|
self.example_email("iago"), self.example_email("hamlet"), Recipient.PERSONAL, "hello"),
|
2017-01-24 07:06:13 +01:00
|
|
|
self.send_message(
|
2017-05-25 01:44:04 +02:00
|
|
|
self.example_email("iago"), self.example_email("hamlet"), Recipient.PERSONAL, "hello2")]
|
2014-02-07 23:10:14 +01:00
|
|
|
|
2016-06-04 20:28:02 +02:00
|
|
|
# Sending a new message results in unread UserMessages being created
|
2014-02-07 23:10:14 +01:00
|
|
|
def test_new_message(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2014-02-07 23:10:14 +01:00
|
|
|
content = "Test message for unset read bit"
|
2017-05-25 01:40:26 +02:00
|
|
|
last_msg = self.send_message(self.example_email("hamlet"), "Verona", Recipient.STREAM, content)
|
2014-02-07 23:10:14 +01:00
|
|
|
user_messages = list(UserMessage.objects.filter(message=last_msg))
|
|
|
|
self.assertEqual(len(user_messages) > 0, True)
|
|
|
|
for um in user_messages:
|
|
|
|
self.assertEqual(um.message.content, content)
|
2017-05-25 01:40:26 +02:00
|
|
|
if um.user_profile.email != self.example_email("hamlet"):
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assertFalse(um.flags.read)
|
|
|
|
|
|
|
|
def test_update_flags(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2014-02-07 23:10:14 +01:00
|
|
|
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags",
|
2014-02-07 23:10:14 +01:00
|
|
|
{"messages": ujson.dumps(self.unread_msg_ids),
|
|
|
|
"op": "add",
|
|
|
|
"flag": "read"})
|
|
|
|
self.assert_json_success(result)
|
|
|
|
|
|
|
|
# Ensure we properly set the flags
|
|
|
|
found = 0
|
2017-03-24 07:51:46 +01:00
|
|
|
for msg in self.get_messages():
|
2014-02-07 23:10:14 +01:00
|
|
|
if msg['id'] in self.unread_msg_ids:
|
|
|
|
self.assertEqual(msg['flags'], ['read'])
|
|
|
|
found += 1
|
|
|
|
self.assertEqual(found, 2)
|
|
|
|
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags",
|
2014-02-07 23:10:14 +01:00
|
|
|
{"messages": ujson.dumps([self.unread_msg_ids[1]]),
|
|
|
|
"op": "remove", "flag": "read"})
|
|
|
|
self.assert_json_success(result)
|
|
|
|
|
|
|
|
# Ensure we properly remove just one flag
|
2017-03-24 07:51:46 +01:00
|
|
|
for msg in self.get_messages():
|
2014-02-07 23:10:14 +01:00
|
|
|
if msg['id'] == self.unread_msg_ids[0]:
|
|
|
|
self.assertEqual(msg['flags'], ['read'])
|
|
|
|
elif msg['id'] == self.unread_msg_ids[1]:
|
|
|
|
self.assertEqual(msg['flags'], [])
|
|
|
|
|
|
|
|
def test_update_all_flags(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2014-02-07 23:10:14 +01:00
|
|
|
|
2017-05-25 01:44:04 +02:00
|
|
|
message_ids = [self.send_message(self.example_email("hamlet"), self.example_email("iago"),
|
2014-02-07 23:10:14 +01:00
|
|
|
Recipient.PERSONAL, "test"),
|
2017-05-25 01:50:35 +02:00
|
|
|
self.send_message(self.example_email("hamlet"), self.example_email("cordelia"),
|
2014-02-07 23:10:14 +01:00
|
|
|
Recipient.PERSONAL, "test2")]
|
|
|
|
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps(message_ids),
|
2016-11-30 14:17:35 +01:00
|
|
|
"op": "add",
|
|
|
|
"flag": "read"})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_success(result)
|
|
|
|
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
2016-11-30 14:17:35 +01:00
|
|
|
"op": "remove",
|
|
|
|
"flag": "read",
|
|
|
|
"all": ujson.dumps(True)})
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assert_json_success(result)
|
|
|
|
|
2017-03-24 07:51:46 +01:00
|
|
|
for msg in self.get_messages():
|
2014-02-07 23:10:14 +01:00
|
|
|
self.assertEqual(msg['flags'], [])
|
|
|
|
|
2016-05-08 15:20:51 +02:00
|
|
|
def test_mark_all_in_stream_read(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
user_profile = self.example_user('hamlet')
|
2016-05-08 15:20:51 +02:00
|
|
|
self.subscribe_to_stream(user_profile.email, "test_stream", user_profile.realm)
|
2017-05-25 01:50:35 +02:00
|
|
|
self.subscribe_to_stream(self.example_email("cordelia"), "test_stream", user_profile.realm)
|
2016-05-08 15:20:51 +02:00
|
|
|
|
2017-05-25 01:40:26 +02:00
|
|
|
message_id = self.send_message(self.example_email("hamlet"), "test_stream", Recipient.STREAM, "hello")
|
|
|
|
unrelated_message_id = self.send_message(self.example_email("hamlet"), "Denmark", Recipient.STREAM, "hello")
|
2016-05-08 15:20:51 +02:00
|
|
|
|
2016-06-03 07:59:00 +02:00
|
|
|
events = [] # type: List[Dict[str, Any]]
|
2016-05-08 15:20:51 +02:00
|
|
|
with tornado_redirected_to_list(events):
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
2016-05-08 15:20:51 +02:00
|
|
|
"op": "add",
|
|
|
|
"flag": "read",
|
|
|
|
"stream_name": "test_stream"})
|
|
|
|
|
|
|
|
self.assert_json_success(result)
|
|
|
|
self.assertTrue(len(events) == 1)
|
|
|
|
|
|
|
|
event = events[0]['event']
|
|
|
|
expected = dict(operation='add',
|
|
|
|
messages=[message_id],
|
|
|
|
flag='read',
|
|
|
|
type='update_message_flags',
|
|
|
|
all=False)
|
|
|
|
|
|
|
|
differences = [key for key in expected if expected[key] != event[key]]
|
|
|
|
self.assertTrue(len(differences) == 0)
|
|
|
|
|
|
|
|
um = list(UserMessage.objects.filter(message=message_id))
|
|
|
|
for msg in um:
|
2017-05-25 01:40:26 +02:00
|
|
|
if msg.user_profile.email == self.example_email("hamlet"):
|
2016-05-08 15:20:51 +02:00
|
|
|
self.assertTrue(msg.flags.read)
|
|
|
|
else:
|
|
|
|
self.assertFalse(msg.flags.read)
|
|
|
|
|
|
|
|
unrelated_messages = list(UserMessage.objects.filter(message=unrelated_message_id))
|
|
|
|
for msg in unrelated_messages:
|
2017-05-25 01:40:26 +02:00
|
|
|
if msg.user_profile.email == self.example_email("hamlet"):
|
2016-05-08 15:20:51 +02:00
|
|
|
self.assertFalse(msg.flags.read)
|
|
|
|
|
|
|
|
def test_mark_all_in_invalid_stream_read(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2016-05-08 15:20:51 +02:00
|
|
|
invalid_stream_name = ""
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
2016-05-08 15:20:51 +02:00
|
|
|
"op": "add",
|
|
|
|
"flag": "read",
|
|
|
|
"stream_name": invalid_stream_name})
|
|
|
|
self.assert_json_error(result, 'No such stream \'\'')
|
|
|
|
|
|
|
|
def test_mark_all_in_stream_topic_read(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2017-05-07 17:21:26 +02:00
|
|
|
user_profile = self.example_user('hamlet')
|
2016-05-08 15:20:51 +02:00
|
|
|
self.subscribe_to_stream(user_profile.email, "test_stream", user_profile.realm)
|
|
|
|
|
2017-05-25 01:40:26 +02:00
|
|
|
message_id = self.send_message(self.example_email("hamlet"), "test_stream", Recipient.STREAM, "hello", "test_topic")
|
|
|
|
unrelated_message_id = self.send_message(self.example_email("hamlet"), "Denmark", Recipient.STREAM, "hello", "Denmark2")
|
2016-06-03 07:59:00 +02:00
|
|
|
events = [] # type: List[Dict[str, Any]]
|
2016-05-08 15:20:51 +02:00
|
|
|
with tornado_redirected_to_list(events):
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
2016-05-08 15:20:51 +02:00
|
|
|
"op": "add",
|
|
|
|
"flag": "read",
|
|
|
|
"topic_name": "test_topic",
|
|
|
|
"stream_name": "test_stream"})
|
|
|
|
|
|
|
|
self.assert_json_success(result)
|
|
|
|
self.assertTrue(len(events) == 1)
|
|
|
|
|
|
|
|
event = events[0]['event']
|
|
|
|
expected = dict(operation='add',
|
|
|
|
messages=[message_id],
|
|
|
|
flag='read',
|
|
|
|
type='update_message_flags',
|
|
|
|
all=False)
|
|
|
|
|
|
|
|
differences = [key for key in expected if expected[key] != event[key]]
|
|
|
|
self.assertTrue(len(differences) == 0)
|
|
|
|
|
|
|
|
um = list(UserMessage.objects.filter(message=message_id))
|
|
|
|
for msg in um:
|
2017-05-25 01:40:26 +02:00
|
|
|
if msg.user_profile.email == self.example_email("hamlet"):
|
2016-05-08 15:20:51 +02:00
|
|
|
self.assertTrue(msg.flags.read)
|
|
|
|
|
|
|
|
unrelated_messages = list(UserMessage.objects.filter(message=unrelated_message_id))
|
|
|
|
for msg in unrelated_messages:
|
2017-05-25 01:40:26 +02:00
|
|
|
if msg.user_profile.email == self.example_email("hamlet"):
|
2016-05-08 15:20:51 +02:00
|
|
|
self.assertFalse(msg.flags.read)
|
|
|
|
|
|
|
|
def test_mark_all_in_invalid_topic_read(self):
|
2016-06-04 20:28:02 +02:00
|
|
|
# type: () -> None
|
2017-05-25 01:40:26 +02:00
|
|
|
self.login(self.example_email("hamlet"))
|
2016-05-08 15:20:51 +02:00
|
|
|
invalid_topic_name = "abc"
|
2016-07-28 00:30:22 +02:00
|
|
|
result = self.client_post("/json/messages/flags", {"messages": ujson.dumps([]),
|
2016-05-08 15:20:51 +02:00
|
|
|
"op": "add",
|
|
|
|
"flag": "read",
|
|
|
|
"topic_name": invalid_topic_name,
|
|
|
|
"stream_name": "Denmark"})
|
|
|
|
self.assert_json_error(result, 'No such topic \'abc\'')
|