Exemplo n.º 1
0
def setUp():
    global added_obj, member_user, user_session
    added_obj = User()
    added_obj.first_name = 'firstname'
    added_obj.last_name = 'lastname'
    added_obj.username = '******'
    added_obj.email = '*****@*****.**'
    added_obj.password = '******'
    success, resp = added_obj.save_new(TEST_SESSION)
    assert success
    assert added_obj.user_id
    user_session = login('testuser', 'testing0')
    assert user_session
    member_user = User()
    member_user.first_name = 'firstname2'
    member_user.last_name = 'lastname2'
    member_user.username = '******'
    member_user.email = '*****@*****.**'
    member_user.password = '******'
    success, resp = member_user.save_new(TEST_SESSION)
    assert success
    assert member_user.user_id
Exemplo n.º 2
0
def test_user_create():
    """UserAPIs: Test create API"""
    #pylint: disable=W0603
    global added_obj
    test_obj = User()
    test_obj.username = '******'
    test_obj.email = '*****@*****.**'
    test_obj.password = '******'
    test_obj.first_name = 'Tester'
    test_obj.full_name = 'Tester, Unit X'
    test_obj.last_name = 'Unit'
    test_obj.phone = '+1 (919) 999-9999'
    test_obj.profiles = {"muam": {"test": "value"}}
    test_obj.create_users = False
    test_obj.create_groups = True
    test_obj.grant_privs = False
    
    success, resp = test_obj.save_new(TEST_SESSION)
    if not success: log_response_error(resp)
    assert success
    added_obj = test_obj