diff --git a/features/assignee/assignee.feature b/features/assignee/assignee.feature index 7212486b3..9a7f6740b 100644 --- a/features/assignee/assignee.feature +++ b/features/assignee/assignee.feature @@ -1,5 +1,18 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing assignee +Feature: Project Properties Assignee Resources + + Background: + Given that I have a valid acess_token + + Scenario: Get a list of available users and groups to be assigned to an activity + Given that I have a valid access_token + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + Scenario: List assignees of an activity Given that I have a valid access_token And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/assignee" @@ -13,18 +26,7 @@ Feature: Testing assignee And the "aas_username" property in row 0 equals "admin" And the "aas_type" property in row 0 equals "user" - Scenario: Get a list of available users and groups to be assigned to an activity - Given that I have a valid access_token - And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/available-assignee" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "array" - And the "aas_uid" property in row 0 equals "1283376915224e7e5ccbfa0059627023" - And the "aas_name" property in row 0 equals "Juana" - And the "aas_lastname" property in row 0 equals "De Arco" - And the "aas_username" property in row 0 equals "juana" - And the "aas_type" property in row 0 equals "user" + Scenario: Get a single user or group of an activity Given that I have a valid access_token @@ -39,18 +41,7 @@ Feature: Testing assignee And the "aas_username" property equals "admin" And the "aas_type" property equals "user" - Scenario: Assign a user or group to an activity - Given that I have a valid access_token - And POST this data: -""" -{ - "ass_uid": "42713393551f2a8aae1fde2096962777", - "ass_type": "group" -} -""" - And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/assignee" - Then the response status code should be 201 - # And store "aas_uid" in session array + # Scenario: Unassign a user or group to an activity # Given that I have a valid access_token diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index b498ca832..1b2ad5249 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1075,6 +1075,21 @@ class RestContext extends BehatContext { throw new PendingException(); } + + /** + * @Then /^the response has (\d+) records$/ + * @Then /^the response has (\d+) record$/ + */ + public function theResponseHasRecords($quantityOfRecords) + { + $data = $this->_data; + if (!is_array($data)) { + throw new Exception("the Response data is not an array!\n\n" ); + } + $currentRecordsCount=count($data); + if($currentRecordsCount!=$quantityOfRecords){ + throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n"); + } + } -} - +} \ No newline at end of file