示例#1
0
 def test_auth_backend(self):
     backend = FacebookBackend()
     facebook = get_facebook_graph(access_token='new_user')
     action, user = connect_user(self.request, facebook_graph=facebook)
     facebook_email = user.email
     facebook_id = user.get_profile().facebook_id
     auth_user = backend.authenticate(facebook_email=facebook_email)
     assert auth_user == user
     
     auth_user = backend.authenticate(facebook_id=facebook_id)
     assert auth_user == user
     
     auth_user = backend.authenticate(facebook_id=facebook_id, facebook_email=facebook_email)
     assert auth_user == user
     
     auth_user = backend.authenticate()
     assert not auth_user
示例#2
0
 def test_auth_backend(self):
     backend = FacebookBackend()
     facebook = get_facebook_graph(access_token='new_user')
     action, user = connect_user(self.request, facebook_graph=facebook)
     facebook_email = user.email
     facebook_id = user.get_profile().facebook_id
     auth_user = backend.authenticate(facebook_email=facebook_email)
     assert auth_user == user
     
     auth_user = backend.authenticate(facebook_id=facebook_id)
     assert auth_user == user
     
     auth_user = backend.authenticate(facebook_id=facebook_id, facebook_email=facebook_email)
     assert auth_user == user
     
     auth_user = backend.authenticate()
     assert not auth_user
示例#3
0
    def test_auth_backend(self):
        backend = FacebookBackend()
        facebook = get_facebook_graph(access_token="new_user")
        action, user = connect_user(self.request, facebook_graph=facebook)
        facebook_email = user.email
        facebook_id = user.get_profile().facebook_id
        auth_user = backend.authenticate(facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id, facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate()
        self.assertIsNone(auth_user)
    def test_auth_backend(self):
        # the auth backend
        backend = FacebookBackend()
        facebook = get_facebook_graph(access_token='new_user')
        action, user = connect_user(self.request, facebook_graph=facebook)
        facebook_email = user.email
        profile = try_get_profile(user)
        user_or_profile = get_instance_for_attribute(
            user, profile, 'facebook_id')
        facebook_id = user_or_profile.facebook_id
        auth_user = backend.authenticate(facebook_email=facebook_email)

        #I GOT IT WORKING!!!!!!!!!!
        self.client.login(facebook_email=facebook_email)


        # response = self.client.get('/login/?testing=True')
        response = self.client.get('/login/')

        self.assertTemplateUsed(response, )
        template_names = []
        for template in response.templates:
            template_names.append(template.name)
        print template_names



        # logger.info('%s %s %s', auth_user.email, user.email, facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id,
                                         facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate()
        self.assertIsNone(auth_user)
示例#5
0
    def test_auth_backend(self):
        # the auth backend
        backend = FacebookBackend()
        facebook = get_facebook_graph(access_token='new_user')
        action, user = connect_user(self.request, facebook_graph=facebook)
        facebook_email = user.email
        profile = try_get_profile(user)
        user_or_profile = get_instance_for_attribute(user, profile,
                                                     'facebook_id')
        facebook_id = user_or_profile.facebook_id
        auth_user = backend.authenticate(facebook_email=facebook_email)
        logger.info('%s %s %s', auth_user.email, user.email, facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id,
                                         facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate()
        self.assertIsNone(auth_user)
示例#6
0
    def test_auth_backend(self):
        # the auth backend
        backend = FacebookBackend()
        facebook = get_facebook_graph(access_token='new_user')
        action, user = connect_user(self.request, facebook_graph=facebook)
        facebook_email = user.email
        profile = try_get_profile(user)
        user_or_profile = get_instance_for_attribute(
            user, profile, 'facebook_id')
        facebook_id = user_or_profile.facebook_id
        auth_user = backend.authenticate(facebook_email=facebook_email)
        logger.info('%s %s %s', auth_user.email, user.email, facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id,
                                         facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate()
        self.assertIsNone(auth_user)
    def test_auth_backend(self):
        # the auth backend
        backend = FacebookBackend()
        facebook = get_facebook_graph(access_token='new_user')
        action, user = connect_user(self.request, facebook_graph=facebook)
        facebook_email = user.email
        profile = try_get_profile(user)
        user_or_profile = get_instance_for_attribute(user, profile,
                                                     'facebook_id')
        facebook_id = user_or_profile.facebook_id
        auth_user = backend.authenticate(facebook_email=facebook_email)

        #I GOT IT WORKING!!!!!!!!!!
        self.client.login(facebook_email=facebook_email)

        # response = self.client.get('/login/?testing=True')
        response = self.client.get('/login/')

        self.assertTemplateUsed(response, )
        template_names = []
        for template in response.templates:
            template_names.append(template.name)
        print template_names

        # logger.info('%s %s %s', auth_user.email, user.email, facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate(facebook_id=facebook_id,
                                         facebook_email=facebook_email)
        self.assertEqual(auth_user, user)

        auth_user = backend.authenticate()
        self.assertIsNone(auth_user)