Add test for /json/set_alert_words.

(imported from commit 307d87331870a89713030e8178b1aa14a31cfdfd)
This commit is contained in:
Steve Howell 2013-12-18 11:30:33 -05:00
parent 0311bf8e4b
commit e7a42ffd02

View File

@ -4967,6 +4967,20 @@ class RateLimitTests(AuthedTestCase):
class AlertWordTests(AuthedTestCase):
interesting_alert_word_list = ['alert', 'multi-word word', ''.decode("utf-8")]
def test_internal_endpoint(self):
email = "cordelia@zulip.com"
self.login(email)
params = {
'alert_words': ujson.dumps(['milk', 'cookies'])
}
result = self.client.post('/json/set_alert_words', params)
self.assert_json_success(result)
user = get_user_profile_by_email(email)
words = user_alert_words(user)
self.assertEqual(words, ['milk', 'cookies'])
def test_default_no_words(self):
"""
Users start out with no alert words.