tests: Update tests to use example profile picture.

So that we can stop using Tim's photo for tests, adds an open
license profile picture to use instead.

Updates tests that used `tim.png` to use the new example profile
picture, which is located in `static/images/test-images/avatars/`.
This commit is contained in:
Lauryn Menard 2022-10-28 11:35:46 +02:00 committed by Tim Abbott
parent 1eda42f509
commit 0c947985bd
4 changed files with 12 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -25,7 +25,7 @@ def generate_dev_ldap_dir(mode: str, num_users: int = 8) -> Dict[str, Dict[str,
ldap_data.append((name, email, phone_number, birthdate)) ldap_data.append((name, email, phone_number, birthdate))
profile_images = [] profile_images = []
for path in glob.glob(os.path.join(static_path("images/landing-page/team"), "*")): for path in glob.glob(os.path.join(static_path("images/test-images/avatars"), "*")):
with open(path, "rb") as f: with open(path, "rb") as f:
profile_images.append(f.read()) profile_images.append(f.read())
ldap_dir = {} ldap_dir = {}

View File

@ -13,7 +13,7 @@
"sn": ["Hamlet"], "sn": ["Hamlet"],
"homePhone": ["123456789"], "homePhone": ["123456789"],
"birthDate": ["1900-09-08"], "birthDate": ["1900-09-08"],
"jpegPhoto": "file:static/images/landing-page/team/tim.png" "jpegPhoto": "file:static/images/test-images/avatars/example_profile_picture.png"
}, },
"uid=cordelia,ou=users,dc=zulip,dc=com": { "uid=cordelia,ou=users,dc=zulip,dc=com": {
@ -38,7 +38,7 @@
"uid": ["newuser"], "uid": ["newuser"],
"sn": ["shortname"], "sn": ["shortname"],
"homePhone": ["a-new-number"], "homePhone": ["a-new-number"],
"jpegPhoto": "file:static/images/landing-page/team/tim.png" "jpegPhoto": "file:static/images/test-images/avatars/example_profile_picture.png"
}, },
"uid=newuser_splitname,ou=users,dc=zulip,dc=com": { "uid=newuser_splitname,ou=users,dc=zulip,dc=com": {

View File

@ -6053,10 +6053,16 @@ class TestLDAP(ZulipLDAPTestCase):
response = self.client_get(url) response = self.client_get(url)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
with open( with open(
os.path.join(settings.DEPLOY_ROOT, "static/images/landing-page/team/tim.png"), "rb" os.path.join(
settings.DEPLOY_ROOT,
"static/images/test-images/avatars/example_profile_picture.png",
),
"rb",
) as f: ) as f:
tim = f.read() example_avatar = f.read()
self.assert_streaming_content(response, resize_avatar(tim, DEFAULT_AVATAR_SIZE)) self.assert_streaming_content(
response, resize_avatar(example_avatar, DEFAULT_AVATAR_SIZE)
)
@override_settings(AUTHENTICATION_BACKENDS=("zproject.backends.ZulipLDAPAuthBackend",)) @override_settings(AUTHENTICATION_BACKENDS=("zproject.backends.ZulipLDAPAuthBackend",))
def test_login_success_when_user_does_not_exist_with_split_full_name_mapping(self) -> None: def test_login_success_when_user_does_not_exist_with_split_full_name_mapping(self) -> None: