diff options
author | raghavendracharik <raghavendrachari.kamsali@hpe.com> | 2016-07-20 04:10:13 -0700 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2016-07-21 11:24:32 +0000 |
commit | 7f623d269e76c3c720891e90a015db2b7f544d10 (patch) | |
tree | 292f6c4824fee21bbc4647c65d26def2bbb57288 /declaration/addtestcase.php | |
parent | 8c68a19284c5507007ead6025ada4a6e61b9ba9f (diff) |
Implementation of testcase/pod declaration dashboard for adding tescases
JIRA: FUNCTEST-26
Change-Id: Iceb1c54ba8c245d43cc553533fdf4fd3284c7132
Signed-off-by: raghavendracharik <raghavendrachari.kamsali@hpe.com>
Diffstat (limited to 'declaration/addtestcase.php')
-rw-r--r-- | declaration/addtestcase.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/declaration/addtestcase.php b/declaration/addtestcase.php new file mode 100644 index 0000000..0e5bed6 --- /dev/null +++ b/declaration/addtestcase.php @@ -0,0 +1,40 @@ +<?php +function sendPostData($url, $post){ + $ch = curl_init($url); + $headers= array('Accept: application/json','Content-Type: application/json'); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_POSTFIELDS,$post); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + $result = curl_exec($ch); + curl_close($ch); + return $result; +} + +if(isset($_REQUEST['url'])){ + $url=$_REQUEST['url']; +} +if(isset($_REQUEST['name'])){ + $name=$_REQUEST['name']; +} +if(isset($_REQUEST['desc'])){ + $desc=$_REQUEST['desc']; +} +if(isset($_REQUEST['project'])){ + + $url_send=$_REQUEST['project']; + $url_send="http://testresults.opnfv.org:80/test/api/v1/projects/".$url_send."/cases"; + $str_data=array('url'=>$url,'name'=>$name,'description'=>$desc); + $str_data=json_encode($str_data); + $res=sendPostData($url_send, $str_data); + echo '<div class="alert alert-success"> <strong>Success!</strong> Added New test Case </div>'; + +}else{ + + echo '<div class="alert alert-danger"> <strong>Error!</strong> Failed to Add New test Case </div>'; + +} + +?> + |