Exemplo n.º 1
0
    def new_user(**kwargs):
        u = User(username=kwargs.pop("username", "testuser"), email=kwargs.pop("email", "*****@*****.**"))
        u.set_password(kwargs.pop("password", "test"))

        u.first_name = kwargs.pop("first_name", "Test")
        u.last_name = kwargs.pop("last_name", "User")

        for attr, value in kwargs.items():
            setattr(u, attr, value)

        u.save()
        return u
Exemplo n.º 2
0
    def new_user(**kwargs):
        u = User(username=kwargs.pop('username', 'testuser'),
                 email=kwargs.pop('email', '*****@*****.**'))
        u.set_password(kwargs.pop('password', 'test'))

        u.first_name = kwargs.pop('first_name', 'Test')
        u.last_name = kwargs.pop('last_name', 'User')

        for attr, value in kwargs.items():
            setattr(u, attr, value)

        u.save()
        return u
Exemplo n.º 3
0
    def new_user(**kwargs):
        u = User(username=kwargs.pop('username', 'testuser'),
                 email=kwargs.pop('email', '*****@*****.**'))
        u.set_password(kwargs.pop('password', 'test'))

        u.first_name = kwargs.pop('first_name', 'Test')
        u.last_name = kwargs.pop('last_name', 'User')

        for attr, value in kwargs.items():
            setattr(u, attr, value)

        u.save()
        return u
Exemplo n.º 4
0
def new_user(**kwargs):
    username = kwargs.pop('username', None) or str(uuid.uuid4())
    u = User(username=username, email=kwargs.pop('email', '*****@*****.**'))

    password = kwargs.pop('password', 'test')
    u.set_password(password)
    u.PASSWORD_FOR_TESTS_ONLY = password

    u.first_name = kwargs.pop('first_name', 'Test')
    u.last_name = kwargs.pop('last_name', 'User')

    for attr, value in kwargs.items():
        setattr(u, attr, value)

    u.save()
    return u