Pruebas de behat para events
This commit is contained in:
@@ -3,4 +3,4 @@ default:
|
|||||||
context:
|
context:
|
||||||
parameters:
|
parameters:
|
||||||
base_url: http://192.168.11.181/api/1.0/michelangelo/
|
base_url: http://192.168.11.181/api/1.0/michelangelo/
|
||||||
access_token: ff4bdec9e8e2e3b2fa3fb03bc3a7d287fd0dcf26
|
access_token: cd5cff9b2e3ebabf49e276e47e977fab5988c00e
|
||||||
|
|||||||
@@ -173,6 +173,26 @@ class RestContext extends BehatContext
|
|||||||
$this->_restObjectMethod = 'get';
|
$this->_restObjectMethod = 'get';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given /^that I want to find a resource with the key "([^"]*)" stored in session array$/
|
||||||
|
*/
|
||||||
|
public function thatIWantToFindAResourceWithTheKeyStoredInSessionArray($varName)
|
||||||
|
{
|
||||||
|
if (file_exists("session.data")) {
|
||||||
|
$sessionData = json_decode(file_get_contents("session.data"));
|
||||||
|
} else {
|
||||||
|
$sessionData = array();
|
||||||
|
}
|
||||||
|
if (!isset($sessionData->$varName) ) {
|
||||||
|
$varValue = '';
|
||||||
|
} else {
|
||||||
|
$varValue = $sessionData->$varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_restFindQueryStringSuffix = "/" . $varValue;
|
||||||
|
$this->_restObjectMethod = 'get';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^that I want to delete a "([^"]*)"$/
|
* @Given /^that I want to delete a "([^"]*)"$/
|
||||||
* @Given /^that I want to delete an "([^"]*)"$/
|
* @Given /^that I want to delete an "([^"]*)"$/
|
||||||
@@ -331,6 +351,10 @@ class RestContext extends BehatContext
|
|||||||
$this->_response = $this->_request->send();
|
$this->_response = $this->_request->send();
|
||||||
break;
|
break;
|
||||||
case 'GET':
|
case 'GET':
|
||||||
|
if (isset($this->_restFindQueryStringSuffix) &&
|
||||||
|
$this->_restFindQueryStringSuffix != '') {
|
||||||
|
$url .= $this->_restFindQueryStringSuffix;
|
||||||
|
}
|
||||||
$this->_request = $this->_client
|
$this->_request = $this->_client
|
||||||
->get($url, $this->_headers);
|
->get($url, $this->_headers);
|
||||||
$this->_response = $this->_request->send();
|
$this->_response = $this->_request->send();
|
||||||
|
|||||||
61
features/processmaker/event.feature
Normal file
61
features/processmaker/event.feature
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
|
Feature: Testing triggers
|
||||||
|
|
||||||
|
@1: TEST FOR POST EVENT /----------------------------------------------------------------------
|
||||||
|
Scenario: Create a event
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And POST this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"evn_description": "DE BEHAT",
|
||||||
|
"evn_status": "ACTIVE",
|
||||||
|
"evn_action": "SEND_MESSAGE",
|
||||||
|
"evn_related_to": "SINGLE",
|
||||||
|
"tas_uid": "97192372152a5c78f04a794095806311",
|
||||||
|
"evn_tas_uid_from": "97192372152a5c78f04a794095806311",
|
||||||
|
"evn_tas_estimated_duration": 1,
|
||||||
|
"evn_time_unit": "DAYS",
|
||||||
|
"evn_when": 1,
|
||||||
|
"evn_when_occurs": "AFTER_TIME",
|
||||||
|
"tri_uid": "95325847552af0c07792c15098680510"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||||
|
Then the response status code should be 201
|
||||||
|
And store "evn_uid" in session array
|
||||||
|
|
||||||
|
@2: TEST FOR PUT EVENT /-----------------------------------------------------------------------
|
||||||
|
Scenario: Update a event
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And PUT this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"evn_description": "change description",
|
||||||
|
"evn_status": "ACTIVE",
|
||||||
|
"evn_action": "SEND_MESSAGE",
|
||||||
|
"evn_related_to": "SINGLE",
|
||||||
|
"tas_uid": "97192372152a5c78f04a794095806311",
|
||||||
|
"evn_tas_uid_from": "97192372152a5c78f04a794095806311",
|
||||||
|
"evn_tas_estimated_duration": 1,
|
||||||
|
"evn_time_unit": "DAYS",
|
||||||
|
"evn_when": 1,
|
||||||
|
"evn_when_occurs": "AFTER_TIME",
|
||||||
|
"tri_uid": "95325847552af0c07792c15098680510"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And that I want to update a resource with the key "evn_uid" stored in session array
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
|
||||||
|
|
||||||
|
@3: TEST FOR GET EVENT /-----------------------------------------------------------------------
|
||||||
|
Scenario: Get a event
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And that I want to find a resource with the key "evn_uid" stored in session array
|
||||||
|
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And that "evn_description" is set to "change description"
|
||||||
23
features/processmaker/trigger.feature
Normal file
23
features/processmaker/trigger.feature
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
|
Feature: Testing triggers
|
||||||
|
Scenario: List triggers of an project
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And I request "project/534152995521df6bb5986c4062665559/triggers"
|
||||||
|
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: Create a trigger
|
||||||
|
Given that I have a valid access_token
|
||||||
|
And POST this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"tri_title": "nuevo triggerr",
|
||||||
|
"tri_description": "descripcion"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/534152995521df6bb5986c4062665559/trigger"
|
||||||
|
Then the response status code should be 201
|
||||||
Reference in New Issue
Block a user