emoji_name: Raise correct exception if emoji_name is missing.

Right now, the message is "Invalid characters in emoji name" when
the emoji_name is empty. Changing check_valid_emoji_name() in
zerver/lib/emoji.py which validates the name to accomodate the case
of missing name. The new message is "Emoji name is missing".
This commit is contained in:
Abhishek-Balaji
2020-04-09 01:19:55 +05:30
committed by Tim Abbott
parent d60efa1478
commit 68257e28ce
2 changed files with 12 additions and 3 deletions

View File

@@ -102,6 +102,13 @@ class RealmEmojiTest(ZulipTestCase):
result = self.client_post('/json/realm/emoji/my_EMoji', info=emoji_data)
self.assert_json_error(result, 'Invalid characters in emoji name')
def test_missing_name_exception(self) -> None:
self.login('iago')
with get_test_image_file('img.png') as fp1:
emoji_data = {'f1': fp1}
result = self.client_post('/json/realm/emoji/', info=emoji_data)
self.assert_json_error(result, 'Emoji name is missing')
def test_upload_admins_only(self) -> None:
self.login('othello')
realm = get_realm('zulip')