import xmlsec


def test_create_signature_template():
    node = xmlsec.create_signature_template()

    assert node.tag.endswith('Signature')
    assert node.xpath('*[local-name() = "SignatureValue"]')
    assert node.xpath('*[local-name() = "SignedInfo"]')

    return node


def test_add_reference():
    node = test_create_signature_template()
    ref = xmlsec.add_reference(node, uri=b'#_34275907093489075620748690')

    assert ref.tag.endswith('Reference')
    assert node.xpath('.//*[local-name() = "Reference"]')

@@ -257,25 +257,8 @@
 ')%0A%0A
-    return node%0A%0A
 %0Adef
@@ -291,21 +291,23 @@
  node = 
-test_
+xmlsec.
 create_s
@@ -438,24 +438,24 @@
 Reference')%0A
-
     assert n
@@ -496,12 +496,877 @@
 ference%22%5D')%0A
+%0A%0Adef test_add_transform():%0A    node = xmlsec.create_signature_template()%0A    ref = xmlsec.add_reference(node, uri=b'#_34275907093489075620748690')%0A    xmlsec.add_transform(ref, xmlsec.method.ENVELOPED)%0A%0A    assert ref.xpath('.//*%5Blocal-name() = %22Transform%22%5D')%0A%0A%0Adef test_ensure_key_info():%0A    node = xmlsec.create_signature_template()%0A    xmlsec.ensure_key_info(node)%0A%0A    assert node.xpath('.//*%5Blocal-name() = %22KeyInfo%22%5D')%0A%0A%0Adef test_add_x509_data():%0A    node = xmlsec.create_signature_template()%0A    info = xmlsec.ensure_key_info(node)%0A    xmlsec.add_x509_data(info)%0A%0A    assert node.xpath('.//*%5Blocal-name() = %22X509Data%22%5D')%0A%0A%0Adef test_add_key_name():%0A    node = xmlsec.create_signature_template()%0A    info = xmlsec.ensure_key_info(node)%0A    xmlsec.add_key_name(info, b'bob.pem')%0A%0A    assert node.xpath('.//*%5Blocal-name() = %22KeyName%22 and text() = %22bob.pem%22%5D')%0A

Add additional tests for templates.