def test_early_failure(self): """ Fail early when passed the wrong XML. """ bad_xml = '''<?xml version="1.0" encoding="utf-8" ?> <WrongRootElement> <UserName>Bob</UserName> </WrongRootElement> ''' with self.assertRaises(ValueError): envelopes.CompletedEnvelope(bad_xml)
def test_root_element_okay(self): # pylint: disable=no-self-use """ No errors occur when initializing the right root element type. """ valid_xml = '''<?xml version="1.0" encoding="utf-8" ?> <DocuSignEnvelopeInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.net/API/3.0"> <EnvelopeStatus></EnvelopeStatus> </DocuSignEnvelopeInformation> ''' envelopes.CompletedEnvelope(valid_xml)
def load_envelope(filename='completed_waiver.xml'): example_xml = dir_path / filename return envelopes.CompletedEnvelope(example_xml.open().read())
def load_envelope(self, filename='completed_waiver.xml'): example_xml = dir_path / filename self.env = envelopes.CompletedEnvelope(example_xml.open().read())