def test_upload_avatar_inTemp(self):
avatar = open(image_path, "rb")
new_dict = default_dict2.copy()
new_dict['avatar'] = avatar
avatar2 = UploadedFile(avatar, name=avatar.name, content_type="image/png", size=os.path.getsize(image_path))
response = self.client.post(reverse('user_profile:edit_profile', kwargs={"username": user_name}),
new_dict, follow=True)
self.assertContains(response, avatar2)
self.delete_image_test()
avatar.close()
# helper function
评论列表
文章目录