Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_events: Use int value of message_retention_days.

Steve Howell10952394b00c
diff --git a/tools/check-node-fixtures b/tools/check-node-fixtures
index f4ca629678a..76086501c0d 100755
--- a/tools/check-node-fixtures
+++ b/tools/check-node-fixtures
@@ -63,11 +63,6 @@ SKIP_LIST = [
EXEMPT_OPENAPI_NAMES = [
# openapi does a nicer union
"realm_user_update_event",
- # message_retention_days
- "default_stream_groups_event",
- "default_streams_event",
- "stream_delete_event",
- "subscription_add_event",
# bots
"realm_bot_add_event",
"realm_bot_update_event",
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py
index 2152fa1f7ab..09efbe80a86 100644
--- a/zerver/lib/event_schema.py
+++ b/zerver/lib/event_schema.py
@@ -32,7 +32,7 @@ basic_stream_fields = [
("invite_only", bool),
("is_announcement_only", bool),
("is_web_public", bool),
- ("message_retention_days", Equals(None)),
+ ("message_retention_days", OptionalType(int)),
("name", str),
("rendered_description", str),
("stream_id", int),
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 1832f1a447c..53bddc8bc4b 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -2173,6 +2173,9 @@ class SubscribeActionTest(BaseAction):
# Subscribe to a totally new invite-only stream, so it's just Hamlet on it
stream = self.make_stream("private", self.user_profile.realm, invite_only=True)
+ stream.message_retention_days = 10
+ stream.save()
+
user_profile = self.example_user('hamlet')
action = lambda: bulk_add_subscriptions([stream], [user_profile])
events = self.verify_action(
@@ -2181,3 +2184,8 @@ class SubscribeActionTest(BaseAction):
num_events=2)
check_stream_create('events[0]', events[0])
check_subscription_add('events[1]', events[1], include_subscribers)
+
+ self.assertEqual(
+ events[0]['streams'][0]['message_retention_days'],
+ 10,
+ )