5 httplib.HTTPConnection.debuglevel = 1
7 class IntegrationTestOAuth2(unittest.TestCase):
10 # -----------------------------------------------------------------------
12 self.oauth = oauth2.OAuth2('5916f12942feea4b3247d42a84371112', '19f7538edd96b6870f2da7e84a6390a4', IntegrationTestOAuth2.access_token)
15 # -----------------------------------------------------------------------
16 def test_authorisation(self):
17 self.oauth.authorise('https://graph.facebook.com/oauth/authorize',
18 'https://graph.facebook.com/oauth/access_token',
19 {'scope': 'user_about_me,friends_about_me,user_birthday,friends_birthday,user_website,friends_website,user_work_history,friends_work_history'})
21 IntegrationTestOAuth2.access_token = self.oauth.get_access_token()
22 assert IntegrationTestOAuth2.access_token
25 # -----------------------------------------------------------------------
26 def test_request(self):
27 if not IntegrationTestOAuth2.access_token:
28 self.test_authorisation()
30 response = self.oauth.request('https://graph.facebook.com/me')
31 data = simplejson.loads(response)
34 raise Exception(data['error'])
37 assert 'name' in data and data['name']
40 if __name__ == '__main__':