def test_group_photo_url(self): group = GroupFactory(photo=image_path) url = group_photo_url(group) self.assertEqual( url, '{hostname}/api/groups-info/{id}/photo/'.format( hostname=settings.HOSTNAME, id=group.id, ), )
def test_custom_header_image(self): pathlib.Path(settings.MEDIA_ROOT).mkdir(exist_ok=True) copyfile(image_path, os.path.join(settings.MEDIA_ROOT, 'photo.jpg')) self.group.photo = 'photo.jpg' self.group.save() email = karrot.groups.emails.prepare_user_inactive_in_group_email( self.user, self.group) html, _ = email.alternatives[0] self.assertIn(group_photo_url(self.group), html)
def test_group_photo_url_without_photo(self): group = GroupFactory() url = group_photo_url(group) self.assertEqual(url, None)