Skip to content

Commit

Permalink
edi_oca: add test for quick_exec functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardoalso committed Feb 20, 2025
1 parent 09f4748 commit 0c3996a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions edi_oca/tests/test_quick_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ def test_quick_exec_on_create_no_call(self):
mocked.assert_not_called()
self.assertEqual(record0.edi_exchange_state, "new")

def test_quick_exec(self):
vals = {
"model": self.partner._name,
"res_id": self.partner.id,
}
model = self.env["edi.exchange.record"]
with mock.patch.object(type(model), "_execute_next_action") as mocked:
record0 = self.backend.create_record("test_csv_output", vals)
# quick exec is off, we should not get any call
mocked.assert_not_called()
self.assertEqual(record0.edi_exchange_state, "new")
self.exchange_type_out.quick_exec = True
with mock.patch.object(type(model), "_execute_next_action") as mocked:
record0 = self.backend.create_record("test_csv_output", vals)
# quick exec is on, we should get a call
mocked.assert_called()
self.assertEqual(record0.edi_exchange_state, "new")

def test_quick_exec_on_create_out(self):
self.exchange_type_out.exchange_file_auto_generate = True
self.exchange_type_out.quick_exec = True
Expand Down

0 comments on commit 0c3996a

Please sign in to comment.