def _update_image(facebook_id, image_url):
    image_name = 'fb_image_%s.jpg' % facebook_id
    image_temp = NamedTemporaryFile()
    try:
        image_response = urllib2.urlopen(image_url)
    except AttributeError:
        image_response = urllib.request.urlopen(image_url)
    image_content = image_response.read()
    image_temp.write(image_content)
    http_message = image_response.info()
    image_size = len(image_content)
    try:
        content_type = http_message.type
    except AttributeError:
        content_type = http_message.get_content_type()
    image_file = InMemoryUploadedFile(
        file=image_temp, name=image_name, field_name='image',
        content_type=content_type, size=image_size, charset=None
    )
    image_file.seek(0)
    image_temp.flush()
    return image_name, image_file
Test that when a user exists the context has that user's account
dataset/ETHPy150Open tschellenbach/Django-facebook/django_facebook/connect.py/_update_image--crossover with--dataset/ETHPy150Open ofa/connect/open_connect/mailer/tests/test_views.py/TestUnsubscribeView.test_context_contains_user