Пример #1
0
def test_sec_buffer_desc_version():
    sec_buffer_desc = sspi.SecBufferDesc(
        [sspi.SecBuffer(1, b"\x00\x01"),
         sspi.SecBuffer(2, b"\x02\x03")])
    assert sec_buffer_desc.version == 0
    sec_buffer_desc.version = 1
    assert sec_buffer_desc.version == 1
Пример #2
0
def test_sec_buffer_desc_str():
    sec_buffer_desc = sspi.SecBufferDesc(
        [sspi.SecBuffer(1, b"\x00\x01"),
         sspi.SecBuffer(2, b"\x02\x03")])
    actual = str(sec_buffer_desc)

    assert actual == r"SecBufferDesc(ulVersion=0, cBuffers=2)"
Пример #3
0
def test_sec_buffer_desc_repr():
    sec_buffer_desc = sspi.SecBufferDesc(
        [sspi.SecBuffer(1, b"\x00\x01"),
         sspi.SecBuffer(2, b"\x02\x03")])
    actual = repr(sec_buffer_desc)

    assert actual == r"<spnego._sspi_raw.sspi.SecBufferDesc(ulVersion=0, cBuffers=2)>"
Пример #4
0
def test_verify_signature_fail():
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.verify_signature(sspi.SecurityContext(), sspi.SecBufferDesc([]))
Пример #5
0
def test_encrypt_message_fail():
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.encrypt_message(sspi.SecurityContext(), sspi.SecBufferDesc([]))
Пример #6
0
def test_accept_security_context_fail():
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.accept_security_context(sspi.Credential(), sspi.SecurityContext(),
                                     sspi.SecBufferDesc([]))