def create_logged_in_user(test, name, email, password="******", is_moderator=False, is_active=False): test.name = name # create use instance User = EmailUser user = User.objects.create_user(name=name, email=email, password=password) user.save() if is_active: user.profile.is_active = True user.profile.save() # make sure this user is in the staff group, too if is_staff_address(email): assign_group_policy(user, "staff") add_user_to_main_site(user) if is_moderator: assign_group_policy(user, "moderator") # log this user in for further testing purposes test.user = user test.client = JSONDefaultClient() test.client.force_login(user)
def create_logged_in_user(test, name, email, password="******"): test.name = name # create use instance User = EmailUser user = User.objects.create_user(name=name, email=email, password=password) user.save() # make sure this user is in the staff group, too if is_staff_address(email): assign_group_policy(user, "staff") add_user_to_main_site(user) # log this user in for further testing purposes test.user = user test.client = Client() test.client.force_login(user)