예제 #1
0
    def handle(self, *args, **options):
        for i in range(100):
            user_name = re.sub('[^A-Za-z0-9]+', '', silly.name())
            email = silly.email()
            password = "******".format(re.sub('[^A-Za-z0-9]+', '', silly.name()),
                                     silly.number())
            gender = Gender.MALE if i == randint(0, 100) else Gender.FEMALE
            status = Status.SINGLE if i == randint(0, 100) else Status.DIVORCEE
            dob = models.DateField()
            is_cohen = True if i == randint(0, 100) else False
            is_single = True if i == randint(0, 100) else False
            user = User.objects.create_user("{}".format(user_name), email,
                                            password)
            user.authenticate()
            # user = authenticate(**form.cleaned_data)
            # user.full_clean()
            # user.save()

            # Add new user to Profile
            p = models.Profile(user=user,
                               gender=gender,
                               status=status,
                               dob=dob,
                               is_cohen=is_cohen,
                               is_single=is_single)

            # pis_single = True
            pfull_clean()
            psave()
    def handle(self, *args, **options):
        n = 100
        for i in tqdm.tqdm(range(n)):
            try:
                user_name = self.get_silly_username()
                email = silly.email()
                password = self.get_silly_username()
                gender = Gender.MALE if randint(1, 3) == 3 else Gender.FEMALE
                status = Status.DIVORCEE if randint(1, 4) == 4 else Status.SINGLE
                dob = silly.datetime().date()
                is_cohen = True if randint(1, 6) == 6 else False
                picture = "text"
                while "placekitten" not in picture:
                    picture = silly.image(width=i+140*2, height=i+95*2).replace(" ", "%20")
                is_single = True

                # is_single = True if round(i % 3, 1) == randint(0, 1) else False
                user = User.objects.create_user("{}".format(user_name), email, password)
                # Add new user to Profile
                p = models.Profile(
                    user=user,
                    gender=gender,
                    status=status,
                    dob=dob,
                    is_cohen=is_cohen,
                    is_single=is_single,
                    picture=picture,
                )
                p.full_clean()
                p.save()
            except IntegrityError:
                print("UNIQUE constraint failed: auth_user.username")
        print("OK")
예제 #3
0
 def setUp(self):
     self.community = Community.objects.create(
         name="Kibbutz Broken Dream",
     )
     self.users_details = dict()
     for i in range(NUM_OF_USERS):
         name = silly.name(slugify=True)
         email = silly.email()
         self.users_details[name] = OCUser.objects.create_superuser(email, name, DEFAULT_PASS)
     self.committee = Committee.objects.create(name="Culture", slug="culture", community=self.community)
     self.selenium = WebDriver()
예제 #4
0
def user_info(user: str = None, id: str = None):
    if id == None:
        set_id = uuid.uuid1()
    else:
        set_id = id
    if user is None:
        username: str = silly.name(capitalize=True)
    else:
        username = user

    title: str = silly.title(capitalize=True)
    company: str = silly.company(capitalize=True)
    address: str = silly.address(capitalize=True)
    city: str = silly.city(capitalize=True)
    country: str = silly.country(capitalize=True)
    postal_code: str = silly.postal_code()
    email = silly.email()
    phone = silly.phone_number()
    description: str = silly.paragraph(length=3)
    website = f'http://www.{silly.domain()}'
    create_date = f'{silly.datetime().year}/{silly.datetime().month}/{silly.datetime().day}'

    result = {
        'useId': str(set_id),
        'username': username,
        'title': title,
        'company': company,
        'address': address,
        'city': city,
        'country': country,
        'postal': postal_code,
        'email': email,
        'phone': phone,
        'website': website,
        'description': description,
        'dateCreate': create_date
    }
    return result
예제 #5
0
def user_test_info():
    set_id = str(uuid.uuid1())
    rand_name: str = silly.noun()
    rand_num: int = random.randint(1, 10000)
    username: str = f"{rand_name}-{rand_num}"
    first_name: str = silly.verb()
    last_name: str = rand_name
    password: str = f"{silly.verb()}-{silly.noun()}"
    title: str = silly.title(capitalize=True)
    company: str = silly.company(capitalize=True)
    address: str = silly.address(capitalize=True)
    city: str = silly.city(capitalize=True)
    country: str = silly.country(capitalize=True)
    postal_code: str = silly.postal_code()
    email = silly.email()
    phone = silly.phone_number()
    description: str = silly.paragraph(length=1)
    website = f"https://www.{silly.domain()}"

    result = {
        "user_id": set_id,
        "user_name": username,
        "first_name": first_name,
        "last_name": last_name,
        "password": password,
        "title": title,
        "company": company,
        "address": address,
        "city": city,
        "country": country,
        "postal": postal_code,
        "email": email,
        "phone": phone,
        "website": website,
        "description": description,
        "is_active": random.choice([True, False]),
    }
    return result
예제 #6
0
def uc_main(howmany: int):
    pw = f'{silly.noun()}{silly.verb()}'

    userList = []
    for i in range(howmany):
        j = {
            "firstName": randFirstName(),
            "lastName": randLastName(),
            "password": pw,
            "title": silly.title(capitalize=True),
            "company": silly.company(capitalize=True),
            "address": silly.address(),
            "city": silly.city(),
            "country": silly.country(),
            "postal": silly.postal_code(),
            "email": silly.email(),
            "website": silly.domain(),
            "description": silly.sentence()
        }
        userList.append(j)

    for u in tqdm(userList, desc='user create'):
        create_user(u)
예제 #7
0
    def handle(self, *args, **options):
        for i in range(100):
            user_name = re.sub('[^A-Za-z0-9]+', '', silly.name())
            email = silly.email()
            password = "******".format(re.sub('[^A-Za-z0-9]+', '', silly.name()), silly.number())
            gender = Gender.MALE if i == randint(0, 100) else Gender.FEMALE
            status = Status.SINGLE if i == randint(0, 100) else Status.DIVORCEE
            dob = models.DateField()
            is_cohen = True if i == randint(0, 100) else False
            is_single = True if i == randint(0, 100) else False
            user = User.objects.create_user("{}".format(user_name), email, password)
            user.authenticate()
            # user = authenticate(**form.cleaned_data)
            # user.full_clean()
            # user.save()

            # Add new user to Profile
            p = models.Profile(
                user=user, gender=gender, status=status, dob=dob, is_cohen=is_cohen, is_single=is_single)

            # pis_single = True
            pfull_clean()
            psave()
    def handle(self, *args, **options):
        n = 100
        for i in tqdm.tqdm(range(n)):
            try:
                user_name = self.get_silly_username()
                email = silly.email()
                password = self.get_silly_username()
                gender = Gender.MALE if randint(1, 3) == 3 else Gender.FEMALE
                status = Status.DIVORCEE if randint(1,
                                                    4) == 4 else Status.SINGLE
                dob = silly.datetime().date()
                is_cohen = True if randint(1, 6) == 6 else False
                picture = "text"
                while "placekitten" not in picture:
                    picture = silly.image(width=i + 140 * 2,
                                          height=i + 95 * 2).replace(
                                              " ", "%20")
                is_single = True

                # is_single = True if round(i % 3, 1) == randint(0, 1) else False
                user = User.objects.create_user("{}".format(user_name), email,
                                                password)
                # Add new user to Profile
                p = models.Profile(
                    user=user,
                    gender=gender,
                    status=status,
                    dob=dob,
                    is_cohen=is_cohen,
                    is_single=is_single,
                    picture=picture,
                )
                p.full_clean()
                p.save()
            except IntegrityError:
                print("UNIQUE constraint failed: auth_user.username")
        print("OK")