示例#1
0
 def test_create_student_valide(self):
     """ here we test valid cases, an exception must not be raised
     """
     
     try:
         User.create_student(name=name, 
                                         email="*****@*****.**", u_email="*****@*****.**")
     except UserAlreadyExistError:
         self.fail("the exception has been raised while a unique user was\
          indeed created")
示例#2
0
 def test_create_association_valide(self):
     """ here we test valid cases, an exception must not be raised
     """
     
     try:
         User.create_association(name=name, 
                                         email="*****@*****.**")
     except UserAlreadyExistError:
         self.fail("the exception has been raised while a unique user was\
          indeed created")
示例#3
0
def init_number_subscriptions():
    clean_up_subscription()
    users = User.query().fetch()
    for user in users:
        followers = Subscription.query(Subscription.following == user.key).count()
        following = Subscription.query(ancestor = user.key).count()
        memcache.init_followers_number(user.key.id(), followers)
        memcache.init_following_number(user.key.id(), following)
示例#4
0
 def get_all_users(self):
     
     user_list = User.query()
     if not user_list.get():
         return None, None
     else:
         
         user_list = user_list.fetch(1000)
         
         
         last_edited = sorted(user_list, key=attrgetter('updated'),reverse=True)[0].updated
         
         return last_edited, user_list
示例#5
0
 def get_updated_user_list(self, updated_after):
     """
     This is a function to get the list of available events
     """
     
     
     user_list = User.query().filter(User.updated > updated_after)
     
     if not user_list.get():
         return None, None
     
     user_list = user_list.order(-User.updated)
     last_update_time = user_list.get().updated
     
     user_list = user_list.fetch(1000)
     
     
     if len(user_list) == 0:
             return None, None
         
     return last_update_time, user_list
示例#6
0
def init_number_users():
    number_of_users = User.query(User.type == 'student').count()
    memcache.init_total_users(number_of_users)
示例#7
0
 def setUp(self):
     super(TestUser, self).setUp()
     self.association = User.create_association(name=name, email=email)
     self.user = User.create_student(name=name, email="*****@*****.**", u_email=u_email)