def test_update_profile__with_photo(self, auth_api_client): profile = generate_user_profile() profile['photo'] = generate_image() response = auth_api_client.put( self.profile_url, data=profile, format='multipart', ) assert response.status_code == status.HTTP_200_OK self.assert_profile(response, profile)
def test_update_profile_with_photo(test_user): changes = { 'first_name': 'fulano', 'last_name': 'de tal', 'photo': generate_image() } user = UserService.update_profile(test_user, changes) assert isinstance(user, User) assert user.first_name == changes.get('first_name') assert user.last_name == changes.get('last_name') assert user.photo is not None assert isinstance(user.photo_url, str)
def test_generate_image(): photo = files.generate_image() assert photo is not None assert isinstance(photo, BytesIO)