def test_bad_cuit(self): """Test using the wrong cuit for a key pair.""" taxpayer = fixtures.AlternateTaxpayerFactory(cuit=20329642339) taxpayer.create_ticket('wsfe') with self.assertRaisesRegex( exceptions.AfipException, # Note: AFIP apparently edited this message and added a typo: 'ValidacionDeToken: No apareci[oó] CUIT en lista de relaciones:', ): models.populate_all()
def test_bad_cuit(self): """Test using the wrong cuit for a key pair.""" taxpayer = factories.AlternateTaxpayerFactory(cuit=20329642339) taxpayer.create_ticket('wsfe') with self.assertRaisesRegex( exceptions.AfipException, # Note: AFIP apparently edited this message and added a typo: 'ValidacionDeToken: No apareci[oó] CUIT en lista de relaciones:', ): models.populate_all()
def setUp(self): """Populate AFIP metadata and create a TaxPayer and PointOfSales.""" super().setUp() models.populate_all() taxpayer = models.TaxPayer.objects.first() taxpayer.fetch_points_of_sales()
from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # -------------------------------------------------------------- from django.core.files import File from django_afip import models # Create a TaxPayer object: taxpayer = models.TaxPayer(pk=1, name='test taxpayer', cuit=20329642330, is_sandboxed=True) # Add the key and certificate files to the TaxPayer: with open( '/home/roberto/Programacion/python/PyAfipWS/cert/reingart.key') as key: taxpayer.key.save('test.key', File(key)) with open( '/home/roberto/Programacion/python/PyAfipWS/cert/reingart.crt') as crt: taxpayer.certificate.save('test.crt', File(crt)) taxpayer.save() # Load all metadata: models.populate_all() # Get the TaxPayer's Point of Sales: taxpayer.fetch_points_of_sales()
def handle(self, *args, **options): models.populate_all()