se usa POLICY_ID desde archivo local, actualizacion de commit [47fd230ff9]
FossilOrigin-Name: 190ab3228ef9e3fbfb4210ae74a8e332cf0aa9d6a0d476e561164bd76ae772f0
This commit is contained in:
		| @@ -1,9 +0,0 @@ | ||||
|  | ||||
| def mock_urlopen(m): | ||||
|     import urllib.request | ||||
|     def mock(url): | ||||
|         class FakeIO: | ||||
|             def read(*args): | ||||
|                 return "X".encode('utf-8') | ||||
|         return FakeIO() | ||||
|     m.setattr(urllib.request, "urlopen", mock) | ||||
|   | ||||
| @@ -19,10 +19,7 @@ def test_xmlsigned_build(monkeypatch): | ||||
|     xml = fe.FeXML('Invoice', | ||||
|                    'http://www.dian.gov.co/contratos/facturaelectronica/v1') | ||||
|  | ||||
|  | ||||
|     with monkeypatch.context() as m: | ||||
|         helpers.mock_urlopen(m) | ||||
|         signer.sign_xml_element(xml.root) | ||||
|     signer.sign_xml_element(xml.root) | ||||
|  | ||||
|     elem = xml.find_or_create_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature') | ||||
|  | ||||
| @@ -38,9 +35,7 @@ def test_xmlsigned_with_passphrase_build(monkeypatch): | ||||
|     xml = fe.FeXML('Invoice', | ||||
|                    'http://www.dian.gov.co/contratos/facturaelectronica/v1') | ||||
|  | ||||
|     with monkeypatch.context() as m: | ||||
|         helpers.mock_urlopen(m) | ||||
|         signer.sign_xml_element(xml.root) | ||||
|     signer.sign_xml_element(xml.root) | ||||
|  | ||||
|     elem = xml.find_or_create_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature') | ||||
|  | ||||
| @@ -105,10 +100,7 @@ def test_xml_sign_dian(monkeypatch): | ||||
|     xmlstring = xml.tostring() | ||||
|     print(xmlstring) | ||||
|     signer = fe.DianXMLExtensionSigner('./tests/example.p12') | ||||
|  | ||||
|     with monkeypatch.context() as m: | ||||
|         helpers.mock_urlopen(m) | ||||
|         xmlsigned = signer.sign_xml_string(xmlstring) | ||||
|     xmlsigned = signer.sign_xml_string(xmlstring) | ||||
|     assert "Signature" in xmlsigned | ||||
|  | ||||
| def test_xml_sign_dian_using_bytes(monkeypatch): | ||||
| @@ -122,7 +114,5 @@ def test_xml_sign_dian_using_bytes(monkeypatch): | ||||
|     p12_data = open('./tests/example.p12', 'rb').read() | ||||
|     signer = fe.DianXMLExtensionSigner.from_bytes(p12_data) | ||||
|  | ||||
|     with monkeypatch.context() as m: | ||||
|         helpers.mock_urlopen(m) | ||||
|         xmlsigned = signer.sign_xml_string(xmlstring) | ||||
|     xmlsigned = signer.sign_xml_string(xmlstring) | ||||
|     assert "Signature" in xmlsigned | ||||
|   | ||||
| @@ -40,10 +40,7 @@ def test_invoicesimple_xml_signed(monkeypatch, simple_invoice): | ||||
|     signer = fe.DianXMLExtensionSigner('./tests/example.p12') | ||||
|  | ||||
|     print(xml.tostring()) | ||||
|     with monkeypatch.context() as m: | ||||
|         import helpers | ||||
|         helpers.mock_urlopen(m) | ||||
|         xml.add_extension(signer) | ||||
|     xml.add_extension(signer) | ||||
|  | ||||
|     elem = xml.get_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension[2]/ext:ExtensionContent/ds:Signature') | ||||
|     assert elem.text is not None | ||||
|   | ||||
| @@ -239,9 +239,7 @@ def test_nomina_xmlsign(monkeypatch): | ||||
|     xml = nomina.toFachoXML() | ||||
|  | ||||
|     signer = fe.nomina.DianXMLExtensionSigner('./tests/example.p12') | ||||
|     with monkeypatch.context() as m: | ||||
|         helpers.mock_urlopen(m) | ||||
|         xml.add_extension(signer) | ||||
|     xml.add_extension(signer) | ||||
|  | ||||
|     print(xml.tostring()) | ||||
|     elem = xml.get_element('/fe:NominaIndividual/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user