コード例 #1
0
 def test_lookup_user_exists(self):
     """ Ok. I guess we'll test this... """
     """ *Crosses fingers* I hope the things I just put in the db in the
     setup method are there """
     callback = BaseFacebookCallback()
     user = callback.lookup_user('facebookid')
     self.assertEquals(user, self.test_user)
コード例 #2
0
 def test_redirect_url_in_session(self):
     request = factory.get('/callback')
     SessionMiddleware().process_request(request)
     request.session['redirect_to'] = 'session_redirect'
     callback = BaseFacebookCallback()
     resp = callback.redirect_url(request)
     self.assertEquals(resp, 'session_redirect')
コード例 #3
0
 def test_redirect_url_no_next_session(self):
     request = factory.get('/callback')
     callback = BaseFacebookCallback()
     SessionMiddleware().process_request(request)
     callback = BaseFacebookCallback()
     resp = callback.redirect_url(request)
     self.assertEquals(resp, settings.LOGIN_REDIRECT_URL)
コード例 #4
0
 def test_call(self):
     """ Make sure we get a 302 back from the callback. """
     basecallback = BaseFacebookCallback()
     ret = basecallback(self.request, self.token)
     self.assertEquals(ret.status_code, 302)
     # logger.debug(str(ret._headers['location'][1]))
     self.assertEquals(ret._headers['location'][1], '/dummy' )
コード例 #5
0
 def test_handle_unauthenticated_user(self):
     callback = BaseFacebookCallback()
     self.assertRaises(NotImplementedError,callback.handle_unauthenticated_user,
             'arg','arg','arg','arg','arg')
コード例 #6
0
 def test_lookup_user(self):
     callback = BaseFacebookCallback()
     self.assertRaises(NotImplementedError,callback.lookup_user,
             'arg','arg','arg')
コード例 #7
0
 def test_fetch_user_data(self):
     callback = BaseFacebookCallback()
     self.assertRaises(NotImplementedError,callback.fetch_user_data,
             'arg','arg','arg')
コード例 #8
0
 def test_identifier_from_data(self):
     callback = BaseFacebookCallback()
     data = {'name':'test name','id':'testid'}
     resp = callback.identifier_from_data(data)
     self.assertEquals(resp,'test-name-testid')
コード例 #9
0
 def test_redirect_url(self):
     callback = BaseFacebookCallback()
     resp = callback.redirect_url(self.request)
     self.assertEquals(resp,'dummy')
コード例 #10
0
 def test_call(self):
     basecallback = BaseFacebookCallback()
     ret = basecallback(self.request, self.access, self.token)
     self.assertEquals(ret.status_code, 302)
     # logger.debug(str(ret._headers['location'][1]))
     self.assertEquals(ret._headers['location'][1], '/dummy' )
コード例 #11
0
 def test_lookup_user_by_email(self):
     """ Derp... """
     callback = BaseFacebookCallback()
     user = callback.lookup_user_by_email('*****@*****.**')
     self.assertEquals(user, self.test_user)
コード例 #12
0
 def test_lookup_user_assoc(self):
     """ Ok, I guess we'....nevermind """
     callback = BaseFacebookCallback()
     assoc = callback.lookup_user_assoc('facebookid')
     self.assertEquals(assoc, UserAssociation.objects.get(user=self.test_user))
コード例 #13
0
 def test_lookup_user_does_not_exist(self):
     """ Ok. I guess we'll test this... """
     callback = BaseFacebookCallback()
     user = callback.lookup_user({'id':'bad-id'})
     self.assertEquals(user,None)