Ejemplo n.º 1
0
def test_get_access_owners(session):

    nombre_acceso = "Control Horarios Acceso Externo"
    acceso = search.access(session, search_filter=nombre_acceso, limit=1)[0]
    assert len(acceso.get_owners(session)) == 1

    nombre_acceso = "Horario Acceso Externo"
    acceso = search.access(session, search_filter=nombre_acceso, limit=1)[0]
    assert len(acceso.get_owners(session)) == 0
Ejemplo n.º 2
0
def test_lookup_access(session):

    accesos = search.access(session, search_filter="*BEPS*", limit=2)
    for acceso in accesos:
        assert acceso == Access(session, href=acceso.href)

    accesos = search.access(session, search_filter="*Horario*", limit=2)
    for acceso in accesos:
        assert acceso == Access(session, href=acceso.href)
Ejemplo n.º 3
0
def test_get_pending_activities_abort(session):

    # required attributes on the Person form (more can be included)
    info_persona = {
        "givenname": "te",
        "sn": "st",
        "cn": "test",
        "initials": "CC",
        "employeenumber": random.randint(1, 99999999),
        "departmentnumber": test_dep,
        "manager": test_manager,
        "title": "test",
        "description": test_description,
        "businesscategory": "test",
        "mobile": "*****@*****.**",
    }
    persona = Person(session, person_attrs=info_persona)

    # crear y validar
    parent = search.organizational_container(session, "organizations",
                                             test_org)[0]
    persona.add(session, parent, "ok")
    time.sleep(5)
    persona_creada = search.people(
        session,
        by="employeenumber",
        search_filter=info_persona["employeenumber"],
        attributes="*",
        limit=1,
    )[0]
    assert persona_creada.employeenumber == str(info_persona["employeenumber"])

    accesses = search.access(session, search_filter="*",
                             limit=2)  # get two accesses
    r = persona_creada.request_access(session, accesses, "ok")
    time.sleep(3)
    request_id = r.request.id

    request = Request(session, id=request_id)
    from_request = request.get_pending_activities(session)

    from_search = search.activities(session, "requestId", request_id)

    assert len(from_request) == len(from_search)

    request.abort(session, "ok")
    time.sleep(3)
    aborted = Request(session, id=request_id)
    assert aborted.process_state == "A"
Ejemplo n.º 4
0
def test_request_access_approve(session):

    # required attributes on the Person form (more can be included)
    info_persona = {
        "givenname": "te",
        "sn": "st",
        "cn": "test",
        "initials": "CC",
        "employeenumber": random.randint(1, 99999999),
        "departmentnumber": test_dep,
        "manager": test_manager,
        "title": "test",
        "description": test_description,
        "businesscategory": "test",
        "mobile": "*****@*****.**",
    }
    persona = Person(session, person_attrs=info_persona)

    # crear y validar
    parent = search.organizational_container(session, "organizations",
                                             test_org)[0]
    persona.add(session, parent, "ok")
    time.sleep(5)
    persona_creada = search.people(
        session,
        by="employeenumber",
        search_filter=info_persona["employeenumber"],
        attributes="*",
        limit=1,
    )[0]
    assert persona_creada.employeenumber == str(info_persona["employeenumber"])

    accesses = search.access(session, search_filter="*",
                             limit=2)  # get two accesses
    r = persona_creada.request_access(session, accesses, "ok")
    time.sleep(3)
    request_id = r.request.id
    print(r)
    actividades = search.activities(session, "requestId", request_id)

    # complete
    r2 = actividades[0].complete(session, "approve", "ok")
    print(r2)

    # now try to complete it again
    r3 = actividades[0].complete(session, "approve", "ok")
    print(r3)
Ejemplo n.º 5
0
def test_search_access(session):
    r = search.access(session, search_filter="*Consulta*", limit=2)
    assert len(r) > 0