예제 #1
0
def delete_user(username):
    """
    Remove the user from the userdatamodel database and all associated storage
    solutions.

    Returns json object
    """
    response = jsonify(admin.delete_user(current_session, username))
    return response
예제 #2
0
def test_delete_user(db_session, awg_users):
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user != None
    user_id = user.id
    user_access = (db_session.query(AccessPrivilege).filter(
        AccessPrivilege.user_id == user_id).all())
    assert user_access != []
    user_groups = (db_session.query(UserToGroup).filter(
        UserToGroup.user_id == user_id).all())
    assert user_groups != []
    adm.delete_user(db_session, "awg_user")
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user == None
    user_access = (db_session.query(AccessPrivilege).filter(
        AccessPrivilege.user_id == user_id).all())
    assert user_access == []
    user_groups = (db_session.query(UserToGroup).filter(
        UserToGroup.user_id == user_id).all())
    assert user_groups == []
예제 #3
0
def test_delete_user(db_session, awg_users, cloud_manager):
    # cirrus doesn't find GPG; no Google deletes attempted.
    cloud_manager.return_value.__enter__.return_value.get_group.return_value = None

    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user != None
    user_id = user.id
    user_access = (db_session.query(AccessPrivilege).filter(
        AccessPrivilege.user_id == user_id).all())
    assert user_access != []
    user_groups = (db_session.query(UserToGroup).filter(
        UserToGroup.user_id == user_id).all())
    assert user_groups != []
    adm.delete_user(db_session, "awg_user")
    user = db_session.query(User).filter(User.username == "awg_user").first()
    assert user == None
    user_access = (db_session.query(AccessPrivilege).filter(
        AccessPrivilege.user_id == user_id).all())
    assert user_access == []
    user_groups = (db_session.query(UserToGroup).filter(
        UserToGroup.user_id == user_id).all())
    assert user_groups == []