'Facebook errors often look like 500s
Its a silly system, but we need to support it
This is actually an application error'

def test_application_error(self):

    graph = self.guy.graph()
    with mock.patch('urllib2.build_opener') as patched:
        opener = mock.MagicMock()
        response = StringIO('{\n                                                        "error":    {\n                                                                "type":    "OAuthException",\n                                                                "message":    "Error    validating    access    token:    USER_ID    has    not    authorized    application    APP_ID"\n                                                        }\n                                                }')
        opener.open.side_effect = HTTPError('bla', 500, 'bla', 'bla', response)
        patched.return_value = opener
        def make_request():
            graph.get('me')
        self.assertRaises(facebook_exceptions.OAuthException, make_request)
