From 7e5ff05b02b3be8bc3dd37551a320c5435b734ad Mon Sep 17 00:00:00 2001 From: Benbb96 Date: Mon, 11 Apr 2022 00:23:22 +0200 Subject: [PATCH] Update documentation --- docs/api.rst | 7 ++++--- helpdesk/tests/test_api.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 805000ca..42f4ec5d 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -22,16 +22,17 @@ You need to provide a JSON body with the following data : - **queue**: ID of the queue - **title**: the title (subject) of the ticket - **description**: the description of the ticket -- **resolution**: an optonal text for the resoltuion of the ticket +- **resolution**: an optional text for the resoltuion of the ticket - **submitter_email**: the email of the ticket submitter - **assigned_to**: ID of the ticket's assigned user - **status**: integer corresponding to the status (OPEN=1, REOPENED=2, RESOLVED=3, CLOSED=4, DUPLICATE=5). It is OPEN by default. - **on_hold**: boolean to indicates if the ticket is on hold - **priority**: integer corresponding to different degrees of priority 1 to 5 (1 is Critical and 5 is Very Low) - **due_date**: date representation for when the ticket is due -- **last_escalation**: date representation of when last escalation has been done - **merged_to**: ID of the ticket to which it is merged +Note that ``status`` will automatically be set to OPEN. Also, some fields are not configurable during creation: ``resolution``, ``on_hold`` and ``merged_to``. + Moreover, if you created custom fields, you can add them into the body with the key ``custom_``. Here is an example of a cURL request to create a ticket (using Basic authentication) :: @@ -39,7 +40,7 @@ Here is an example of a cURL request to create a ticket (using Basic authenticat curl --location --request POST 'http://127.0.0.1:8000/api/tickets/' \ --header 'Authorization: Basic YWRtaW46YWRtaW4=' \ --header 'Content-Type: application/json' \ - --data-raw '{"queue": 1, "title": "Test Ticket API", "description": "Test create ticket from API", "submitter_email": "test@mail.com","priority": 4}' + --data-raw '{"queue": 1, "title": "Test Ticket API", "description": "Test create ticket from API", "submitter_email": "test@mail.com", "priority": 4}' PUT --- diff --git a/helpdesk/tests/test_api.py b/helpdesk/tests/test_api.py index 3213509b..4b679479 100644 --- a/helpdesk/tests/test_api.py +++ b/helpdesk/tests/test_api.py @@ -109,10 +109,10 @@ class TicketTest(APITestCase): self.assertEqual(created_ticket.assigned_to, test_user) self.assertEqual(created_ticket.submitter_email, 'test@mail.com') self.assertEqual(created_ticket.priority, 1) - self.assertFalse(created_ticket.on_hold) + self.assertFalse(created_ticket.on_hold) # on_hold is False on creation self.assertEqual(created_ticket.status, Ticket.OPEN_STATUS) # status is always open on creation self.assertEqual(created_ticket.due_date, datetime(2022, 4, 10, 15, 6, tzinfo=UTC)) - self.assertIsNone(created_ticket.merged_to) + self.assertIsNone(created_ticket.merged_to) # merged_to can not be set on creation def test_edit_api_ticket(self): staff_user = User.objects.create_user(username='admin', is_staff=True)