def seed_some_users(amount=50) -> None: me = User(id=str(uuid4()), email="*****@*****.**", password=_auth_service.hash_password("FunkyP455")).save() super_user = Role.objects(name="SuperUser").first() me.roles.append(super_user) me.save() for _ in range(amount): User(id=str(uuid4()), email=fake.ascii_company_email(), password=_auth_service.hash_password( fake.password(length=10, digits=True, upper_case=True, lower_case=True))).save()
def test_can_add_role_to_user(): role = _role_repo.create_new_role("Testing Role") user = User( id=str(uuid4()), email=faker.ascii_company_email(), password=_auth_service.hash_password( faker.password(length=10, digits=True, upper_case=True, lower_case=True))) user.save() data = {} data["roleId"] = role.id data["userId"] = user.id result = _user_repo.add_role_to_user(data) assert result is not None