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)
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')
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)
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' )
def test_handle_unauthenticated_user(self): callback = BaseFacebookCallback() self.assertRaises(NotImplementedError,callback.handle_unauthenticated_user, 'arg','arg','arg','arg','arg')
def test_lookup_user(self): callback = BaseFacebookCallback() self.assertRaises(NotImplementedError,callback.lookup_user, 'arg','arg','arg')
def test_fetch_user_data(self): callback = BaseFacebookCallback() self.assertRaises(NotImplementedError,callback.fetch_user_data, 'arg','arg','arg')
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')
def test_redirect_url(self): callback = BaseFacebookCallback() resp = callback.redirect_url(self.request) self.assertEquals(resp,'dummy')
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' )
def test_lookup_user_by_email(self): """ Derp... """ callback = BaseFacebookCallback() user = callback.lookup_user_by_email('*****@*****.**') self.assertEquals(user, self.test_user)
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))
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)