From fb283ac6727b584f689ec254d175f9f4da49f44f Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 16 Aug 2018 14:17:20 +0000 Subject: [PATCH] tests: Test JsonableError in lookup_default_stream_groups(). --- zerver/tests/test_subs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index dd84f060ad..5bdeb96e8f 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -1358,6 +1358,13 @@ class DefaultStreamGroupTest(ZulipTestCase): "stream_names": ujson.dumps(stream_names)}) self.assert_json_error(result, "Default stream group name 'abc\000' contains NULL (0x00) characters.") + # Also test that lookup_default_stream_groups raises an + # error if we pass it a bad name. This function is used + # during registration, but it's a bit heavy to do a full + # test of that. + with self.assertRaisesRegex(JsonableError, 'Invalid default stream group invalid-name'): + lookup_default_stream_groups(['invalid-name'], realm) + class SubscriptionPropertiesTest(ZulipTestCase): def test_set_stream_color(self) -> None: """