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")
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")
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)
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
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
def init_number_users(): number_of_users = User.query(User.type == 'student').count() memcache.init_total_users(number_of_users)
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)