def test_001_get_xsd_documentation(self): """Getting a documentation from a given Clark's Notated xsd element""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32) documentation = invoice.get_documentation( '{http://www.sat.gob.mx/cfd/3}' 'Impuestos') self.assertTrue(True) # TODO: Find the proper search element syntax
def test_002_get_cfd_debugged(self): """With a given valid dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32, debug_mode=True) self.assertTrue(invoice.document, 'A valid dictionary gave error debugged_mode enabled')
def test_005_get_cfd_invalid_debugged(self): """With a given `invalid` dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice( self.dict_invoice_basic_32_errored, debug_mode=True) self.assertTrue(invoice.document, 'A invalid dictionary gave error debugged_mode ' 'enabled gave an error.')
def test_005_get_cfd_invalid_debugged(self): """With a given `invalid` dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_errored, debug_mode=True) self.assertTrue( invoice.document, 'A invalid dictionary gave error debugged_mode ' 'enabled gave an error.')
def test_004_get_errored(self): """With a given invalid dict raise properly errors on ups object""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_errored) self.assertTrue(bool(invoice.ups), 'An invalid dictionary gave a ' 'valid output, that is wrong.') # Ok it failed!, then we assert if # the message is the one I expected for. self.assertTrue(invoice.ups.message.find('Emisor') > 0, 'The expected failed entry Emisor was erroneous.') invoice = cfdv32.get_invoice({}) self.assertTrue(bool(invoice.ups), 'An empty dict should give me the validation') invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_false) self.assertNotIn('False', invoice.ups.message, 'Passing a False value return a False string which is' 'incorrect %s ' % invoice.ups.message)
def test_002_get_cfd_debugged(self): """With a given valid dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32, debug_mode=True) self.assertFalse( bool(invoice.ups), 'A valid dictionary gave error debugged_mode enabled %s' % invoice.document) self.assertTrue(invoice.document, 'A valid dictionary gave error debugged_mode enabled')
def test_005_get_norfc(self): """With a given `invalid` dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice( self.dict_invoice_basic_32_norfc, debug_mode=True) self.assertTrue(invoice.document, 'A invalid dictionary gave error debugged_mode ' 'enabled gave an error.') self.assertTrue(bool(invoice.ups), 'Error expected and not received.') self.assertTrue(invoice.ups.message.find('rfc') >= 0, 'Expected a controlled error mentioning RFC and gotten other thing.')
def test_005_get_norfc(self): """With a given `invalid` dict an invoice object is created in debug_mode""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_norfc, debug_mode=True) self.assertTrue( invoice.document, 'A invalid dictionary gave error debugged_mode ' 'enabled gave an error.') self.assertTrue(bool(invoice.ups), 'Error expected and not received.') self.assertTrue( invoice.ups.message.find('rfc') >= 0, 'Expected a controlled error mentioning RFC and gotten other thing.' )
def test_004_get_errored(self): """With a given invalid dict raise properly errors on ups object""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_errored) self.assertTrue( bool(invoice.ups), 'An invalid dictionary gave a ' 'valid output, that is wrong.') # Ok it failed!, then we assert if # the message is the one I expected for. self.assertTrue( invoice.ups.message.find('Emisor') > 0, 'The expected failed entry Emisor was erroneous. %s' % invoice.ups.message) invoice = cfdv32.get_invoice({}) self.assertTrue(bool(invoice.ups), 'An empty dict should give me the validation') invoice = cfdv32.get_invoice(self.dict_invoice_basic_32_false) self.assertNotIn( 'False', invoice.ups.message, 'Passing a False value return a False string which is' 'incorrect %s ' % invoice.ups.message)
def test_003_get_cfd(self): """With a given valid dict an invoice object is created""" invoice = cfdv32.get_invoice(self.dict_invoice_basic_32) self.assertTrue(invoice.document, 'A valid dictionary gave error an error')