Cambio de path /tmp en los behat que obtienen un archivo
This commit is contained in:
@@ -35,7 +35,7 @@ Feature: User
|
||||
#GET /api/1.0/{workspace}/user/{usr_uid}
|
||||
# Upload a image
|
||||
Scenario: Upload a image
|
||||
Given POST I want to upload the image "/home/wendy/photo/pic3.jpg" to user "00000000000000000000000000000001". Url "user/"
|
||||
Given POST I want to upload the image "/photo/pic3.jpg" to user "00000000000000000000000000000001". Url "user/"
|
||||
|
||||
#POST /api/1.0/{workspace}/user
|
||||
# Create new User
|
||||
|
||||
@@ -101,9 +101,9 @@ Feature: User Main Tests
|
||||
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 without replaced by, calendar | 1 | /photo/pic1.jpg |
|
||||
| Create without calendar | 2 | /photo/pic2.jpg |
|
||||
| Create with all fields | 3 | /photo/pic3.jpg |
|
||||
|
||||
|
||||
Scenario: Get the users List when there are exactly 68 users
|
||||
|
||||
@@ -23,7 +23,7 @@ Scenario: Returns an uploaded documents for a given case
|
||||
|
||||
|
||||
Scenario: Post metadata and then upload documents for a given case
|
||||
Given POST upload an input document "/home/wendy/uploadfiles/test1.html" to "cases/170220159534214f642abb8058832933/input-document"
|
||||
Given POST upload an input document "/uploadfiles/test1.html" to "cases/170220159534214f642abb8058832933/input-document"
|
||||
"""
|
||||
{
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ Scenario Outline: Post metadata and then upload documents for a given case
|
||||
And store "app_doc_uid" in session array as variable "app_doc_uid_<app_doc_uid_number>"
|
||||
|
||||
Examples:
|
||||
| app_doc_uid_number | document_file | case_uid | inp_doc_uid | tas_uid | app_doc_comment |
|
||||
| 1 | /home/wendy/uploadfiles/test1.html | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 2 | /home/wendy/uploadfiles/random.jpg | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 3 | /home/wendy/uploadfiles/test.pm | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 4 | /home/wendy/uploadfiles/test.txt | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| app_doc_uid_number | document_file | case_uid | inp_doc_uid | tas_uid | app_doc_comment |
|
||||
| 1 | /uploadfiles/test1.html | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 2 | /uploadfiles/random.jpg | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 3 | /uploadfiles/test.pm | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
| 4 | /uploadfiles/test.txt | 170220159534214f642abb8058832933 | 68671480353319e5e1dee74089764900 | 19582733053319e304cfa76025663570 | comment 1 |
|
||||
|
||||
Scenario Outline: Returns an uploaded documents for a given case
|
||||
Given I request "cases/<case_uid>/input-document/app_doc_uid" with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
|
||||
|
||||
@@ -131,11 +131,11 @@ Scenario Outline: Upload files to same folders
|
||||
And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
|
||||
|
||||
Examples:
|
||||
| file | prf_path | prf_number |
|
||||
|/home/wendy/uploadfiles/test1.html | templates | 4 |
|
||||
|/home/wendy/uploadfiles/test2.html | templates | 5 |
|
||||
|/home/wendy/uploadfiles/test.txt | public | 6 |
|
||||
|/home/wendy/uploadfiles/TestQA.html| templates | 7 |
|
||||
| file | prf_path | prf_number |
|
||||
| /uploadfiles/test1.html | templates | 4 |
|
||||
| /uploadfiles/test2.html | templates | 5 |
|
||||
| /uploadfiles/test.txt | public | 6 |
|
||||
| /uploadfiles/TestQA.html| templates | 7 |
|
||||
|
||||
|
||||
Scenario Outline: Verify if TestQA was overwrited
|
||||
@@ -216,12 +216,12 @@ Scenario Outline: Delete folder
|
||||
|
||||
|
||||
#BUG 15207, The "Upload" accepts files with other extensions
|
||||
#
|
||||
#Scenario Outline: Upload files to same folders "Project - Process Complete BPMN"
|
||||
# Given POST I want to upload the file "<file>" to path "<prf_path>". Url "project/1455892245368ebeb11c1a5001393784/file-manager"
|
||||
# And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
|
||||
# And the response status message should have the following text "incorrect extension"
|
||||
#
|
||||
# Examples:
|
||||
# | file | prf_path | prf_number |
|
||||
# |/home/wendy/uploadfiles/SnagIt823.exe | templates | 1 |
|
||||
|
||||
Scenario Outline: Upload files to same folders "Project - Process Complete BPMN"
|
||||
Given POST I want to upload the file "<file>" to path "<prf_path>". Url "project/1455892245368ebeb11c1a5001393784/file-manager"
|
||||
And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
|
||||
And the response status message should have the following text "incorrect extension"
|
||||
|
||||
Examples:
|
||||
| file | prf_path | prf_number |
|
||||
| /uploadfiles/SnagIt823.exe | templates | 1 |
|
||||
@@ -137,7 +137,7 @@ Scenario: Get for Export Project
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/xml"
|
||||
And save exported process to "/home/wendy/uploadfiles/" as "Process_Complete_BPMN"
|
||||
And save exported process to "/uploadfiles/" as "Process_Complete_BPMN"
|
||||
|
||||
|
||||
Scenario: Delete a Project created previously in this script
|
||||
@@ -160,12 +160,12 @@ Scenario Outline: Import a process
|
||||
|
||||
|
||||
Examples:
|
||||
| project_file | import_option | prj_uid_number |
|
||||
| /home/wendy/uploadfiles/Process_NewCreate_BPMN.pmx | create | 1 |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 2 |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite | 3 |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable | 4 |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep | 5 |
|
||||
| project_file | import_option | prj_uid_number |
|
||||
| /uploadfiles/Process_NewCreate_BPMN.pmx | create | 1 |
|
||||
| /uploadfiles/Process_Complete_BPMN.pmx | create | 2 |
|
||||
| /uploadfiles/Process_Complete_BPMN.pmx | overwrite | 3 |
|
||||
| /uploadfiles/Process_Complete_BPMN.pmx | disable | 4 |
|
||||
| /uploadfiles/Process_Complete_BPMN.pmx | keep | 5 |
|
||||
|
||||
|
||||
#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc.
|
||||
@@ -413,8 +413,8 @@ Scenario Outline: Import a process
|
||||
And the type is "object"
|
||||
|
||||
Examples:
|
||||
| project_file | import_option |
|
||||
| /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create |
|
||||
| project_file | import_option |
|
||||
| /uploadfiles/Process_Complete_BPMN.pmx | create |
|
||||
|
||||
|
||||
#For example, to export a empty process
|
||||
@@ -424,7 +424,7 @@ Scenario: Get for Export Project "Export process empty"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/xml"
|
||||
And save exported process to "/home/wendy/uploadfiles/" as "Export process empty"
|
||||
And save exported process to "/uploadfiles/" as "Export process empty"
|
||||
|
||||
Scenario: Delete a Project created previously in this script "Export process empty"
|
||||
Given that I want to delete a resource with the key "prj_uid" stored in session array
|
||||
@@ -435,7 +435,7 @@ Scenario: Delete a Project created previously in this script "Export process emp
|
||||
And the type is "object"
|
||||
|
||||
Scenario: Import a process "Export process empty"
|
||||
Given POST upload a project file "/home/wendy/uploadfiles/Export_process_empty.pmx" to "project/import?option=create"
|
||||
Given POST upload a project file "/uploadfiles/Export_process_empty.pmx" to "project/import?option=create"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
|
||||
@@ -11,8 +11,8 @@ Scenario Outline: Import a process negative tests
|
||||
|
||||
|
||||
Examples:
|
||||
| Description | project_file | import_option | error_code | error_message |
|
||||
| Import process when the process alredy exists | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 400 | already exists |
|
||||
| Description | project_file | import_option | error_code | error_message |
|
||||
| Import process when the process alredy exists | /uploadfiles/Process_Complete_BPMN.pmx | create | 400 | already exists |
|
||||
|
||||
|
||||
Scenario Outline: Import a process with wrong "option"
|
||||
@@ -22,6 +22,6 @@ Scenario Outline: Import a process with wrong "option"
|
||||
|
||||
|
||||
Examples:
|
||||
| Description | project_file | option | option_group | error_message |
|
||||
| Invalid option | /home/wendy/uploadfiles/Process_NewCreate_BPMN.pmx | sample | merge | option |
|
||||
| Invalid option_group | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | sample | option_group |
|
||||
| Description | project_file | option | option_group | error_message |
|
||||
| Invalid option | /uploadfiles/Process_NewCreate_BPMN.pmx | sample | merge | option |
|
||||
| Invalid option_group | /uploadfiles/Process_Complete_BPMN.pmx | create | sample | option_group |
|
||||
@@ -1362,6 +1362,7 @@ class RestContext extends BehatContext
|
||||
*/
|
||||
public function postIWantToUploadTheFileToPathPublicUrl($prfFile, $prfPath, $url)
|
||||
{
|
||||
$prfFile = sys_get_temp_dir() . $prfFile;
|
||||
$baseUrl = $this->getParameter('base_url');
|
||||
$url = $baseUrl.$url;
|
||||
$accesstoken = $this->getParameter('access_token');
|
||||
@@ -1421,6 +1422,7 @@ class RestContext extends BehatContext
|
||||
*/
|
||||
public function postIWantToUploadTheImageToUser($imageFile, $usrUid, $url)
|
||||
{
|
||||
$imageFile = sys_get_temp_dir() . $imageFile;
|
||||
$baseUrl = $this->getParameter('base_url');
|
||||
$url = $baseUrl.$url.$usrUid."/image-upload";
|
||||
|
||||
@@ -1462,6 +1464,7 @@ class RestContext extends BehatContext
|
||||
}
|
||||
|
||||
$usrUid = $varValue;
|
||||
$imageFile = sys_get_temp_dir() . $imageFile;
|
||||
|
||||
$this->postIWantToUploadTheImageToUser($imageFile, $usrUid, $url);
|
||||
}
|
||||
@@ -1518,6 +1521,7 @@ class RestContext extends BehatContext
|
||||
*/
|
||||
public function postUploadAnInputDocumentTo($file, $url, PyStringNode $string)
|
||||
{
|
||||
$file = sys_get_temp_dir() . $file;
|
||||
$postFields = json_decode($string);
|
||||
$postFields->form ='@'.$file;
|
||||
|
||||
@@ -1533,6 +1537,7 @@ class RestContext extends BehatContext
|
||||
*/
|
||||
public function postUploadAProjectFile($file, $url)
|
||||
{
|
||||
$file = sys_get_temp_dir() . $file;
|
||||
$postFields = new StdClass();
|
||||
$postFields->project_file ='@'.$file;
|
||||
|
||||
@@ -1637,7 +1642,7 @@ class RestContext extends BehatContext
|
||||
|
||||
|
||||
}
|
||||
|
||||
$destinationFolder = sys_get_temp_dir() . $destinationFolder;
|
||||
$exportedProcessFileName = $destinationFolder.str_replace(" ","_",$exportedProcessFileName).".pmx";
|
||||
|
||||
$this->printDebug("Exporting process to: $exportedProcessFileName");
|
||||
@@ -1646,6 +1651,50 @@ class RestContext extends BehatContext
|
||||
chmod($exportedProcessFileName, 0777);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^POST a dynaform:$/
|
||||
*/
|
||||
public function postADynaform(PyStringNode $string)
|
||||
{
|
||||
$postFields = json_decode($string);
|
||||
|
||||
if ((isset($postFields->dyn_content))&&(file_exists(sys_get_temp_dir() . $postFields->dyn_content))) {
|
||||
$postFields->dyn_content = sys_get_temp_dir() . $postFields->dyn_content;
|
||||
$this->printDebug("Extracting dyanform content from: ".$postFields->dyn_content."\n");
|
||||
$postFields->dyn_content = file_get_contents($postFields->dyn_content);
|
||||
|
||||
$string = json_encode($postFields);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->_restObjectMethod = 'post';
|
||||
$this->_headers['Content-Type'] = 'application/json; charset=UTF-8';
|
||||
$this->_requestBody = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^PUT a dynaform:$/
|
||||
*/
|
||||
public function putADynaform(PyStringNode $string)
|
||||
{
|
||||
$postFields = json_decode($string);
|
||||
|
||||
if ((isset($postFields->dyn_content))&&(file_exists(sys_get_temp_dir() . $postFields->dyn_content))) {
|
||||
$postFields->dyn_content = sys_get_temp_dir() . $postFields->dyn_content;
|
||||
$this->printDebug("Extracting dyanform content from: ".$postFields->dyn_content."\n");
|
||||
$postFields->dyn_content = file_get_contents($postFields->dyn_content);
|
||||
|
||||
$string = json_encode($postFields);
|
||||
}
|
||||
|
||||
|
||||
$this->_restObjectMethod = 'put';
|
||||
$this->_headers['Content-Type'] = 'application/json; charset=UTF-8';
|
||||
$this->_requestBody = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user