Exemplo n.º 1
0
    def test_persistent_graph(self):
        request = RequestMock().get('/')
        request.session = {}
        request.user = AnonymousUser()

        graph = get_facebook_graph(access_token='short_username')
        FacebookUserConverter(graph)
        action, user = connect_user(self.request, facebook_graph=graph)
        self.assertEqual(action, CONNECT_ACTIONS.REGISTER)
Exemplo n.º 2
0
    def test_persistent_graph(self):
        request = RequestMock().get('/')
        request.session = {}
        request.user = AnonymousUser()

        graph = get_facebook_graph(access_token='short_username')
        FacebookUserConverter(graph)
        action, user = connect_user(self.request, facebook_graph=graph)
        self.assertEqual(action, CONNECT_ACTIONS.REGISTER)
Exemplo n.º 3
0
 def test_gender_matching(self):
     request = RequestMock().get('/')
     request.session = {}
     request.user = AnonymousUser()
     graph = get_persistent_graph(request, access_token='paul')
     converter = FacebookUserConverter(graph)
     base_data = converter.facebook_profile_data()
     self.assertEqual(base_data['gender'], 'male')
     data = converter.facebook_registration_data()
     self.assertEqual(data['gender'], 'm')
     action, user = connect_user(self.request, facebook_graph=graph)
     self.assertEqual(user.get_profile().gender, 'm')
Exemplo n.º 4
0
 def test_gender_matching(self):
     request = RequestMock().get('/')
     request.session = {}
     request.user = AnonymousUser()
     graph = get_persistent_graph(request, access_token='paul')
     converter = FacebookUserConverter(graph)
     base_data = converter.facebook_profile_data()
     self.assertEqual(base_data['gender'], 'male')
     data = converter.facebook_registration_data()
     self.assertEqual(data['gender'], 'm')
     action, user = connect_user(self.request, facebook_graph=graph)
     self.assertEqual(user.get_profile().gender, 'm')
Exemplo n.º 5
0
 def test_long_username(self):
     request = RequestMock().get('/')
     request.session = {}
     request.user = AnonymousUser()
     graph = get_persistent_graph(request, access_token='long_username')
     converter = FacebookUserConverter(graph)
     base_data = converter.facebook_registration_data()
     action, user = connect_user(self.request, facebook_graph=graph)
     self.assertEqual(len(base_data['username']), 30)
     self.assertEqual(len(user.username), 30)
     self.assertEqual(len(user.first_name), 30)
     self.assertEqual(len(user.last_name), 30)
Exemplo n.º 6
0
 def test_persistent_graph(self):
     request = RequestMock().get('/')
     request.session = {}
     request.user = AnonymousUser()
     get_persistent_graph(request, access_token='short_username')
Exemplo n.º 7
0
 def test_persistent_graph(self):
     request = RequestMock().get('/')
     request.session = {}
     request.user = AnonymousUser()
     get_persistent_graph(request, access_token='short_username')