예제 #1
0
def test_update_user_without_conflict(db_session, awg_users, oauth_client):
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user != None
    adm.update_user(db_session, "awg_user", "admin", "*****@*****.**",
                    "new_awg_user")
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user == None
    user = db_session.query(User).filter(
        User.username == "new_awg_user").first()
    assert user.username == "new_awg_user"
    assert user.is_admin == True
    assert user.email == "*****@*****.**"
예제 #2
0
def update_user(username):
    """
    Create a user on the userdatamodel database

    Returns a json object
    """
    name = request.get_json().get("name", None)
    role = request.get_json().get("role", None)
    email = request.get_json().get("email", None)
    return jsonify(admin.update_user(current_session, username, role, email, name))
예제 #3
0
def test_update_user_to_existing_name(db_session, awg_users):
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user != None
    with pytest.raises(UserError):
        adm.update_user(db_session, "awg_user", "admin", "*****@*****.**",
                        "awg_user_2")