示例#1
0
def test_verify_signature_fail():
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.verify_signature(sspi.SecurityContext(), sspi.SecBufferDesc([]))
示例#2
0
def test_query_context_attributes_invalid_handle(attribute):
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.query_context_attributes(sspi.SecurityContext(), attribute)
示例#3
0
def test_query_context_attributes_unknown():
    with pytest.raises(
            NotImplementedError,
            match=
            "Only names, package_info, session_key, or sizes is implemented"):
        sspi.query_context_attributes(sspi.SecurityContext(), 1024)
示例#4
0
def test_initialize_security_context_fail():
    with pytest.raises(WindowsError, match="The handle specified is invalid"):
        sspi.initialize_security_context(sspi.Credential(),
                                         sspi.SecurityContext(),
                                         u"target_name")
示例#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([]))