mirror of https://github.com/zulip/zulip.git
test_users: Use delivery_email instead of email to generate gravatar url.
We always use delivery_email to generate gravatar_url, but in test_admin_api_hide_emails we were passing email to get_gravatar_url and matched with the avatar_url field of the fetched user object. The tests were passing because the email_address_is_realm_public was using old realm object and thus email field was incorrectly set to delivery_email even when email_address_visibility was set to EMAIL_ADDRESS_VISIBILITY_ADMINS. This commit fixes the test to pass delivery_email to get_gravatar_url.
This commit is contained in:
parent
84cd68a5aa
commit
9a03a78e3d
|
@ -358,13 +358,14 @@ class PermissionTest(ZulipTestCase):
|
|||
# required in apps like the mobile apps.
|
||||
# delivery_email is sent for admins.
|
||||
admin.refresh_from_db()
|
||||
user.refresh_from_db()
|
||||
self.login_user(admin)
|
||||
result = self.client_get("/json/users", {"client_gravatar": "true"})
|
||||
self.assert_json_success(result)
|
||||
members = result.json()["members"]
|
||||
hamlet = find_dict(members, "user_id", user.id)
|
||||
self.assertEqual(hamlet["email"], f"user{user.id}@zulip.testserver")
|
||||
self.assertEqual(hamlet["avatar_url"], get_gravatar_url(user.email, 1))
|
||||
self.assertEqual(hamlet["avatar_url"], get_gravatar_url(user.delivery_email, 1))
|
||||
self.assertEqual(hamlet["delivery_email"], self.example_email("hamlet"))
|
||||
|
||||
def test_user_cannot_promote_to_admin(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue