'A DELETE request to /json/users/me/avatar should delete the user avatar and return gravatar URL'

def test_delete_avatar(self):

    self.login(self.example_email('hamlet'))
    hamlet = self.example_user('hamlet')
    hamlet.avatar_source = UserProfile.AVATAR_FROM_USER
    hamlet.save()
    result = self.client_delete('/json/users/me/avatar')
    user_profile = self.example_user('hamlet')
    self.assert_json_success(result)
    json = ujson.loads(result.content)
    self.assertIn('avatar_url', json)
    self.assertEqual(json['avatar_url'], avatar_url(user_profile))
    self.assertEqual(user_profile.avatar_source, UserProfile.AVATAR_FROM_GRAVATAR)
    self.assertEqual(user_profile.avatar_version, 2)
