'Test that when upload validation fails, the proper HTTP response and
messages are returned.'

@patch('PIL.Image.open')
def test_upload_failure(self, image_open, mock_log):

    image_open.side_effect = [Exception(u'whoops'), None]
    with make_image_file() as image_file:
        with self.assertRaises(Exception):
            self.client.post(self.url, {'file': image_file}, format='multipart')
        self.check_images(False)
        self.check_has_profile_image(False)
    self.assertFalse(mock_log.info.called)
    self.assert_no_events_were_emitted()
