def test_verify(name): # Load the SAML XML document to verify. filename = path.join(BASE_DIR, '%s-signed.xml' % name) expected = etree.parse(filename).getroot() # Sign the result. with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream: assert saml.verify(expected, stream)
def test_verify_with_bad_signature_returns_False(name): filename = path.join(BASE_DIR, '%s-signed.xml' % name) expected = etree.parse(filename).getroot() signature_node = xmlsec.tree.find_node(expected, xmlsec.Node.SIGNATURE) signature_node.clear() with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream: assert saml.verify(expected, stream) is False
def test_verify_with_no_signature_returns_False(name): filename = path.join(BASE_DIR, '%s-simple.xml' % name) expected = etree.parse(filename).getroot() with open(path.join(BASE_DIR, 'rsapub.pem'), 'r') as stream: assert saml.verify(expected, stream) is False