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_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_lookup_user_by_email(self):
     """ Derp... """
     callback = BaseFacebookCallback()
     user = callback.lookup_user_by_email('[email protected]')
     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)