def test_updating_user_profile_photo(self):
"""
Emulate the variables that nginx passes in via the upload module
and see if the file gets uploaded.
"""
photo_path = os.path.abspath("static/images/test-avatar.png")
arguments = {
'photo_path': photo_path,
'photo_content_type': "image/png",
'photo_name': os.path.basename(photo_path),
'photo_size': os.path.getsize(photo_path)
}
response = self.post_url('/account/settings/profile', arguments=arguments)
user_reloaded = User.get('id = %s', self.user.id)
self.assertTrue(user_reloaded.profile_image)
self.assertTrue(user_reloaded.profile_image_url().find('/account') > -1)
评论列表
文章目录