Esempio n. 1
0
def create_user(data=None):
    seeder = Seed()

    data = fake_user(data)

    user = UserSerializer(data=data)
    user.is_valid()
    user.save()

    return data
Esempio n. 2
0
def fake_user(data=None):
    seeder = Seed()

    if not data:
        data = {}

    if 'email' not in data.keys():
        data['email'] = seeder.faker().email()

    if 'password' not in data.keys():
        data['password'] = seeder.faker().lexify(text='????????',
                                                 letters=CHARS)

    return data
Esempio n. 3
0
def get_reset_data(data=None):
    seeder = Seed()
    if not data:
        data = {}

    if 'token' not in data.keys():
        data['token'] = seeder.faker().lexify(text='?' * 32, letters=CHARS)

    if 'password' not in data.keys():
        data['password'] = seeder.faker().lexify(text='????????',
                                                 letters=CHARS)

    if 'password_confirmed' not in data.keys():
        data['password_confirmed'] = data['password']

    return data
Esempio n. 4
0
 def setUp(self):
     self.seed1 = Seed()
     self.seed2 = Seed()
Esempio n. 5
0
def get_random_email():
    seeder = Seed()
    return seeder.faker().email()
Esempio n. 6
0
def get_random_name():
    seeder = Seed()
    return seeder.faker().name()
Esempio n. 7
0
def get_random_password():
    seeder = Seed()
    return seeder.faker().lexify(text='????????', letters=CHARS)