Fix ChangeSettingsTest caching issue causing test failures.

This commit is contained in:
Tim Abbott 2016-06-15 14:57:34 -07:00
parent 06079042d4
commit 10dd9addb7
1 changed files with 3 additions and 0 deletions

View File

@ -966,11 +966,14 @@ class ChangeSettingsTest(AuthedTestCase):
json_result = self.client.post(pattern, json_result = self.client.post(pattern,
{param: ujson.dumps(True)}) {param: ujson.dumps(True)})
self.assert_json_success(json_result) self.assert_json_success(json_result)
# refetch user_profile object to correctly handle caching
user_profile = get_user_profile_by_email("hamlet@zulip.com")
self.assertEqual(getattr(user_profile, param), True) self.assertEqual(getattr(user_profile, param), True)
json_result = self.client.post(pattern, json_result = self.client.post(pattern,
{param: ujson.dumps(False)}) {param: ujson.dumps(False)})
self.assert_json_success(json_result) self.assert_json_success(json_result)
# refetch user_profile object to correctly handle caching
user_profile = get_user_profile_by_email("hamlet@zulip.com") user_profile = get_user_profile_by_email("hamlet@zulip.com")
self.assertEqual(getattr(user_profile, param), False) self.assertEqual(getattr(user_profile, param), False)