Skip to content

Commit

Permalink
[FIX] l10n_br_nfse_focus: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Oct 19, 2024
1 parent 4d4771b commit d9bcf20
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions l10n_br_nfse_focus/tests/test_l10n_br_nfse_focus.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,38 +380,27 @@ def test_serialize(self):

def test_document_export(self):
"""Tests export of document data."""
record = self.nfse_demo
record.processador_edoc = PROCESSADOR_OCA # Setting document processor to OCA
record.document_type_id.code = MODELO_FISCAL_NFE # Setting document type to NFe

# Testing with non-filtered conditions
record = self.nfse_demo
record.company_id.provedor_nfse = None # Resetting NFSe provider
record.processador_edoc = PROCESSADOR_OCA
record.company_id.provedor_nfse = None

record._document_export() # Exporting document data
record.action_document_confirm()

self.assertFalse(
record.company_id.provedor_nfse
) # Asserting NFSe provider not set
self.assertFalse(record.company_id.provedor_nfse)

self.assertEqual(record.state, SITUACAO_EDOC_A_ENVIAR)

# Testing with filtered conditions
record = self.nfse_demo
record.company_id.provedor_nfse = (
"focusnfe" # Setting NFSe provider to focusnfe
)
record.processador_edoc = PROCESSADOR_OCA # Setting processor to OCA
record.document_type_id.code = (
MODELO_FISCAL_NFSE # Setting document type to NFSe
)
record.company_id.provedor_nfse = "focusnfe"

record._document_export()

record._document_export() # Exporting document data again
self.assertTrue(record.company_id.provedor_nfse)

self.assertTrue(
record.company_id.provedor_nfse
) # Asserting NFSe provider is set
self.assertTrue(
record.authorization_event_id
) # Asserting authorization event is set
self.assertTrue(record.authorization_event_id)

@patch(
"odoo.addons.l10n_br_nfse_focus.models.document.FocusnfeNfse.query_focus_nfse_by_rps"
Expand Down

0 comments on commit d9bcf20

Please sign in to comment.