[IMP] docuseal_signing: add unit tests for API payload and server action
Cover with a mocked Docuseal API (shared ``DocusealApiMockMixin`` capturing every request): - field value conversion matrix in ``_create_submissions``: char, selection label, many2one/many2many display names, date formatting, empty value left editable while set values are locked - payload structure and one-submission-per-partner behavior - draft submissions created with ``send_email`` disabled - API URL trailing slash stripped - server action creation is idempotent Assisted-By: GLM-5.3-Flash
This commit is contained in:
@@ -17,3 +17,22 @@ class TestServerAction(TransactionCase):
|
||||
|
||||
template.unlink()
|
||||
self.assertFalse(action.exists())
|
||||
|
||||
def test_create_server_action_is_idempotent(self):
|
||||
"""Creating the contextual action twice updates the existing
|
||||
action instead of generating a duplicate."""
|
||||
template = self.env["docuseal.template"].create({
|
||||
"name": "Contract",
|
||||
"template_id": 456,
|
||||
})
|
||||
template.action_create_server_action()
|
||||
first_action = template.server_action_id
|
||||
template.action_create_server_action()
|
||||
|
||||
self.assertEqual(template.server_action_id, first_action)
|
||||
self.assertEqual(
|
||||
self.env["ir.actions.server"].search_count([
|
||||
("name", "=", "Request signature (Contract)"),
|
||||
]),
|
||||
1,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user