Beispiel #1
0
 def create_user_association(self, user, token, expires, user_data):
     """ Create UserAssociation """
     assoc = UserAssociation (
             user=user,
             token=str(token),
             expires=expires,
             identifier=user_data['id']
     )
     assoc.save()
     return assoc
Beispiel #2
0
 def create_user_with_fb_profile(self):
     user = User()
     user.username = 'with_profile'
     user.email = '[email protected]'
     user.first_name = 'With'
     user.last_name = 'FBProfile'
     user.password = 'derp'
     user.save()
     #create facebook profile
     assoc = UserAssociation(
         user=user,
         token='preauthdtoken',
         expires = datetime.now() + timedelta(1),
         identifier='8675309'
     )
     assoc.save()
     
     self.user_with_profile = user
 def setUp(self):
     # logger.debug("callback test case setup")
     self.request = factory.get('/callback',data={'next':'dummy'})
     test_user = User()
     test_user.username = 'test'
     test_user.save()
     self.test_user = test_user
     self.anon_user = AnonymousUser()
     self.request.user = test_user
     assoc = UserAssociation()
     assoc.user = test_user
     assoc.token = 'facebooktokenstring'
     assoc.identifier = 'facebookid'
     assoc.expires = datetime.datetime.now() + datetime.timedelta(1)
     assoc.save()
     self.token = OAuth20Token(assoc.token, 5555)
     self.access = OAuthAccess()