summaryrefslogtreecommitdiffstats
path: root/utils/test/declaration/addtestcase.php
diff options
context:
space:
mode:
authorraghavendracharik <raghavendrachari.kamsali@hpe.com>2016-07-20 04:10:13 -0700
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-21 11:24:32 +0000
commitfff0e399eb7b57ecd0ddce1b742da8c22968014c (patch)
tree2cf9c913288563494d7140a84d0608cb7cf67779 /utils/test/declaration/addtestcase.php
parenta510a653663b917c7910b4934c580060837965d0 (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 'utils/test/declaration/addtestcase.php')
-rw-r--r--utils/test/declaration/addtestcase.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/utils/test/declaration/addtestcase.php b/utils/test/declaration/addtestcase.php
new file mode 100644
index 000000000..0e5bed689
--- /dev/null
+++ b/utils/test/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>';
+
+}
+
+?>
+