From 2dd7180a8bd8aadd7200272276f1bad452009b67 Mon Sep 17 00:00:00 2001 From: Raj Shah Date: Fri, 27 Oct 2023 13:33:18 +0530 Subject: [PATCH] Added test cases in update event and task --- .../updateAccountEvent.scenarios.json | 154 ++++++++++++------ .../updateAccountTask.scenarios.json | 102 ++++++++++++ 2 files changed, 210 insertions(+), 46 deletions(-) diff --git a/src/test/resources/data/functional/controllers/accountEventController/updateAccountEvent.scenarios.json b/src/test/resources/data/functional/controllers/accountEventController/updateAccountEvent.scenarios.json index 5e1d460e..14ca4652 100644 --- a/src/test/resources/data/functional/controllers/accountEventController/updateAccountEvent.scenarios.json +++ b/src/test/resources/data/functional/controllers/accountEventController/updateAccountEvent.scenarios.json @@ -1,43 +1,105 @@ [ - { - "description": "Should successfully update the event for given event id", - "input": { - "body": { - "description":"Create Event", - "start_datetime": "2023-07-21T13:12:17.000+0000", - "end_datetime": "2023-07-22T13:12:17.000+0000" - }, - "accountId": "0011e00000bWSxdAAG", - "eventId":"0691e000001X1yTAAS" + { + "description": "Should successfully update the event for given event id", + "input": { + "body": { + "description":"Create Event", + "start_datetime": "2023-07-21T13:12:17.000+0000", + "end_datetime": "2023-07-22T13:12:17.000+0000" }, - "mocks": { - "makeCompositeRequest": { - "compositeResponse": [ - { - "body": null, - "httpHeaders": {}, - "httpStatusCode": 200, - "referenceId": "UpdateEvent" - } - ] - } + "accountId": "0011e00000bWSxdAAG", + "eventId":"0691e000001X1yTAAS" + }, + "mocks": { + "makeCompositeRequest": { + "compositeResponse": [ + { + "body": null, + "httpHeaders": {}, + "httpStatusCode": 200, + "referenceId": "UpdateEvent" + } + ] + } + }, + "output": {} + }, + { + "description": "Should fail when event task description is not provided", + "input": { + "body": { + "start_datetime": "2023-07-21T13:12:17.000+0000", + "end_datetime": "2023-07-22T13:12:17.000+0000" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "missing_description" + ] + } + }, + { + "description": "Should fail when the event start_datetime is invalid", + "input": { + "body": { + "description":"Create Event", + "start_datetime": "2023-07-21", + "end_datetime": "2023-07-22T13:12:17.000+0000" }, - "output": {} + "accountId": "0011e00000bWSxdAAG" }, - { - "description": "should return error response when event id is invalid", - "input": { - "body": { - "description":"Create Event", - "start_datetime": "2023-07-21T13:12:17.000+0000", - "end_datetime": "2023-07-22T13:12:17.000+0000" - }, - "accountId": "0011e00000bWSxdAAG", - "eventId":"invalidEventId" + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "invalid_start_datetime" + ] + } + }, + { + "description": "Should fail when the event end_datetime is invalid", + "input": { + "body": { + "description":"Create Event", + "start_datetime": "2023-07-22T13:12:17.000+0000", + "end_datetime": "2023-07-22T13:12.000+0000" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "invalid_end_datetime" + ] + } + }, + { + "description": "should return error response when event id is invalid", + "input": { + "body": { + "description":"Create Event", + "start_datetime": "2023-07-21T13:12:17.000+0000", + "end_datetime": "2023-07-22T13:12:17.000+0000" }, - "mocks": { - "makeCompositeRequest": { - "compositeResponse": [ + "accountId": "0011e00000bWSxdAAG", + "eventId":"invalidEventId" + }, + "mocks": { + "makeCompositeRequest": { + "compositeResponse": [ { "body": [ { @@ -51,15 +113,15 @@ } ] } - }, - "output": { - "http_code": 400, - "message": "At least one parameter is invalid or missing.", - "code": "INVALID_PARAMS", - "internal_error_identifier": "l_ua_uae_usae_pr_1", - "param_errors": [ - "invalid_event_id" - ] - } + }, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "l_ua_uae_usae_pr_1", + "param_errors": [ + "invalid_event_id" + ] } - ] \ No newline at end of file + } +] \ No newline at end of file diff --git a/src/test/resources/data/functional/controllers/accountTaskController/updateAccountTask.scenarios.json b/src/test/resources/data/functional/controllers/accountTaskController/updateAccountTask.scenarios.json index fa0533bb..35226689 100644 --- a/src/test/resources/data/functional/controllers/accountTaskController/updateAccountTask.scenarios.json +++ b/src/test/resources/data/functional/controllers/accountTaskController/updateAccountTask.scenarios.json @@ -24,6 +24,108 @@ }, "output": {} }, + { + "description": "Should fail when the task description is empty", + "input": { + "body": { + "crm_organization_user_id":"0011e00000bWSxdAA1", + "description":"", + "due_date":"2023-12-01" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "missing_description" + ] + } + }, + { + "description": "Should fail when the task description is not provided", + "input": { + "body": { + "crm_organization_user_id":"0011e00000bWSxdAA1", + "due_date":"2023-12-01" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "missing_description" + ] + } + }, + { + "description": "Should fail when the task due_date is not provided", + "input": { + "body": { + "crm_organization_user_id":"0011e00000bWSxdAA1", + "description":"Update remaining documentations" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "invalid_due_date" + ] + } + }, + { + "description": "Should fail when the task crm_organization_user_id is not provided", + "input": { + "body": { + "description":"Update remaining documentations", + "due_date":"2023-12-01" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "missing_crm_organization_user_id" + ] + } + }, + { + "description": "Should fail when the task Due is not valid", + "input": { + "body": { + "crm_organization_user_id":"0011e00000bWSxdAA1", + "description":"Update remaining documentations", + "due_date":"2023-120-01" + }, + "accountId": "0011e00000bWSxdAAG" + }, + "mocks": {}, + "output": { + "http_code": 400, + "message": "At least one parameter is invalid or missing.", + "code": "INVALID_PARAMS", + "internal_error_identifier": "b_2", + "param_errors": [ + "invalid_due_date" + ] + } + }, { "description": "should return error response when task id is invalid", "input": {