Merged in wnestor/processmaker (pull request #234)
Culminacion del feature pm user y creacion de nuevos archivos
This commit is contained in:
@@ -0,0 +1,96 @@
|
|||||||
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
|
Feature: Files Manager Resources
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given that I have a valid access_token
|
||||||
|
|
||||||
|
Scenario: Get a list of main process files manager
|
||||||
|
Given I request "project/1265557095225ff5c688f46031700471/file-manager"
|
||||||
|
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: Get a list public folder of process files manager
|
||||||
|
Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=public"
|
||||||
|
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: Get a list templates folder of process files manager
|
||||||
|
Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=templates"
|
||||||
|
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 Outline: Post files
|
||||||
|
Given POST this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"prf_filename": "<file_name>",
|
||||||
|
"prf_path": "<path>",
|
||||||
|
"prf_content": "<content>"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/1265557095225ff5c688f46031700471/file-manager"
|
||||||
|
Then the response status code should be <http_code>
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the content type is "application/json"
|
||||||
|
And the type is "<type>"
|
||||||
|
And store "prf_uid" in session array as variable "prf_uid<i>"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| test_description | file_name | path | content | http_code | type |
|
||||||
|
| into public folder | testbehat.txt | public/ | test | 200 | object |
|
||||||
|
| into maintemplates folder | testbehat.txt | templates/ | test | 200 | object |
|
||||||
|
| into public subfolder | testbehat.txt | public/test_folder | test | 200 | object |
|
||||||
|
| into public subfolder | testbehat.txt | templates/test_folder | test | 200 | object |
|
||||||
|
|
||||||
|
Scenario Outline: Post files
|
||||||
|
Given PUT this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"prf_filename": "<file_name>",
|
||||||
|
"prf_content": "<content>"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=<path>"
|
||||||
|
Then the response status code should be <http_code>
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the content type is "application/json"
|
||||||
|
And the type is "<type>"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| test_description | file_name | path | content | http_code | type |
|
||||||
|
| put into public folder | testbehat.txt | public/ | put test | 200 | object |
|
||||||
|
| put into maintemplates folder | testbehat.txt | templates/ | put test | 200 | object |
|
||||||
|
| put into public subfolder | testbehat.txt | public/test_folder | put test | 200 | object |
|
||||||
|
| put into public subfolder | testbehat.txt | templates/test_folder | put test | 200 | object |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario Outline: Delete file
|
||||||
|
Given that I want to delete a "<path>"
|
||||||
|
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=<path>"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| test_description | path |
|
||||||
|
| delete public folder | public/testbehat.txt |
|
||||||
|
| delete maintemplates folder | templates/testbehat.txt |
|
||||||
|
| delete public subfolder | public/test_folder/testbehat.txt |
|
||||||
|
| delete public subfolder | templates/test_folder/testbehat.txt |
|
||||||
|
|
||||||
|
#Para que funcione este test, debe existir el archivo que se quiere subir
|
||||||
|
Scenario: Post files
|
||||||
|
Given POST I want to upload the file "/home/daniel/test.txt" to path "public". Url to create prf_uid "project/1265557095225ff5c688f46031700471/file-manager" and updload "project/1265557095225ff5c688f46031700471/file-manager/upload"
|
||||||
|
|
||||||
|
Scenario: Delete file
|
||||||
|
Given that I want to delete a "public/test.txt"
|
||||||
|
And I request "project/1265557095225ff5c688f46031700471/file-manager?path=public/test.txt"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
@@ -94,7 +94,28 @@ Feature: User Main Tests
|
|||||||
| Create user Inactive | 4 | daniela | perez | daniela | daniela@gmail.com | grenn #544 | 555-6565 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | | INACTIVE | PROCESSMAKER_OPERATOR | sample | sample |
|
| Create user Inactive | 4 | daniela | perez | daniela | daniela@gmail.com | grenn #544 | 555-6565 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | | INACTIVE | PROCESSMAKER_OPERATOR | sample | sample |
|
||||||
| Create user Vacation | 5 | micaela | sanchez | micaela | micaela@gmail.com | sancjh #544 | 555-6652 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | | VACATION | PROCESSMAKER_OPERATOR | sample | sample |
|
| Create user Vacation | 5 | micaela | sanchez | micaela | micaela@gmail.com | sancjh #544 | 555-6652 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | | VACATION | PROCESSMAKER_OPERATOR | sample | sample |
|
||||||
|
|
||||||
|
|
||||||
|
#Para que funcione este test, debe existir el archivo que se quiere subir
|
||||||
|
#GET /api/1.0/{workspace}/user/{usr_uid}
|
||||||
|
# Upload a image
|
||||||
|
Scenario: Upload a image
|
||||||
|
Given POST I want to upload the image "/home/daniel/pic3.jpg" to user "00000000000000000000000000000001". Url "user/"
|
||||||
|
|
||||||
|
|
||||||
|
# Upload a image
|
||||||
|
Scenario Outline: Upload a image
|
||||||
|
Given POST I want to upload the image "<usr_photo>" to user with the key "usr_uid" stored in session array as variable "usr_uid_<usr_number>". Url "user/"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
| Test_description | usr_number | usr_photo |
|
||||||
|
| Create without replaced by, calendar | 1 | /home/wendy/photo/pic1.jpg |
|
||||||
|
| Create without calendar | 2 | /home/wendy/photo/pic2.jpg |
|
||||||
|
| Create with all fields | 3 | /home/wendy/photo/pic3.jpg |
|
||||||
|
| Create user Inactive | 4 | ~/userPhoto/abcd.jpg |
|
||||||
|
| Create user Vacation | 5 | ~/userPhoto/abcd.jpg |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Get the users List when there are exactly 63 users
|
Scenario: Get the users List when there are exactly 63 users
|
||||||
And I request "users"
|
And I request "users"
|
||||||
And the content type is "application/json"
|
And the content type is "application/json"
|
||||||
|
|||||||
@@ -1359,6 +1359,7 @@ class RestContext extends BehatContext
|
|||||||
{
|
{
|
||||||
$baseUrl = $this->getParameter('base_url');
|
$baseUrl = $this->getParameter('base_url');
|
||||||
$url = $baseUrl.$url.$usrUid."/image-upload";
|
$url = $baseUrl.$url.$usrUid."/image-upload";
|
||||||
|
|
||||||
$accesstoken = $this->getParameter('access_token');
|
$accesstoken = $this->getParameter('access_token');
|
||||||
$headr = array();
|
$headr = array();
|
||||||
$headr[] = 'Authorization: Bearer '.$accesstoken;
|
$headr[] = 'Authorization: Bearer '.$accesstoken;
|
||||||
@@ -1369,8 +1370,36 @@ class RestContext extends BehatContext
|
|||||||
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
|
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
$postResult = curl_exec($ch);
|
$postResult = curl_exec($ch);
|
||||||
|
|
||||||
|
if( $postResult === false)
|
||||||
|
{
|
||||||
|
//trigger_error(curl_error($ch));
|
||||||
|
throw new Exception("Image upload failed ($imageFile):\n\n"
|
||||||
|
. curl_error($ch));
|
||||||
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
echo $postResult;
|
echo $postResult;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given /^POST I want to upload the image "([^"]*)" to user with the key "([^"]*)" stored in session array as variable "([^"]*)"\. Url "([^"]*)"$/
|
||||||
|
*/
|
||||||
|
public function postIWantToUploadTheImageToUserWithTheKeyStoredInSessionArrayAsVariableUsrUidUrl($imageFile, $varName, $sessionVarName, $url)
|
||||||
|
{
|
||||||
|
if (file_exists("session.data")) {
|
||||||
|
$sessionData = json_decode(file_get_contents("session.data"));
|
||||||
|
} else {
|
||||||
|
$sessionData = array();
|
||||||
|
}
|
||||||
|
if (!isset($sessionData->$sessionVarName) ) {
|
||||||
|
$varValue = '';
|
||||||
|
} else {
|
||||||
|
$varValue = $sessionData->$sessionVarName;
|
||||||
|
}
|
||||||
|
|
||||||
|
$usrUid = $varValue;
|
||||||
|
|
||||||
|
$this->postIWantToUploadTheImageToUser($imageFile, $usrUid, $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user