Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding tests for LINE output, removing DescribeActions output as defa…

…ult for API
  • Loading branch information...
commit a8a218d22b19078bdb4d03afa31ec35fab54cb15 1 parent 10d342b
Evan Tahler authored
View
3  API/index.php
@@ -128,9 +128,8 @@
if ($ActionPreformed == 0 || $PARAMS["Action"] == "" || strlen($PARAMS["Action"]) == 0)
{
if ($ERROR == 100) {
- $ERROR = "That Action cannot be found. Did you send the 'Action' parameter?";
+ $ERROR = "That Action cannot be found. Did you send the 'Action' parameter? List Actions with Action=DescribeActions";
$Action = "Unknown Action";
- $OUTPUT["KnownActions"] = humanize_actions();
}
}
View
15 SPEC/system/output_types.php
@@ -15,7 +15,7 @@
$APIRequest = new APIRequest($TestURL, $PostArray);
$APIDATA = $APIRequest->DoRequest();
$T->assert(">",count($APIDATA),0);
- $T->assert("==",$APIDATA["ERROR"],"That Action cannot be found. Did you send the 'Action' parameter?");
+ $T->assert("==",$APIDATA["ERROR"],"That Action cannot be found. Did you send the 'Action' parameter? List Actions with Action=DescribeActions");
$T->context("JSON",2);
$PostArray = array("OutputType" => "JSON", "LimitLockPass" => $CONFIG['CorrectLimitLockPass']);
@@ -23,7 +23,7 @@
$APIRequest->DoRequest();
$JSON_resp = json_decode($APIRequest->ShowRawResponse(), true);
$T->assert(">",count($JSON_resp),0);
- $T->assert("==",$JSON_resp["ERROR"],"That Action cannot be found. Did you send the 'Action' parameter?");
+ $T->assert("==",$JSON_resp["ERROR"],"That Action cannot be found. Did you send the 'Action' parameter? List Actions with Action=DescribeActions");
$T->context("XML",2);
$PostArray = array("OutputType" => "XML", "LimitLockPass" => $CONFIG['CorrectLimitLockPass']);
@@ -31,7 +31,16 @@
$APIRequest->DoRequest();
$XML_resp = simplexml_load_string($APIRequest->ShowRawResponse());
$T->assert(">",count($XML_resp),0);
- $T->assert("==",$XML_resp->ERROR,"That Action cannot be found. Did you send the 'Action' parameter?");
+ $T->assert("==",$XML_resp->ERROR,"That Action cannot be found. Did you send the 'Action' parameter? List Actions with Action=DescribeActions");
+
+ $T->context("LINE",2); // CONSOLE and LINE are similar
+ $PostArray = array("OutputType" => "LINE", "LimitLockPass" => $CONFIG['CorrectLimitLockPass']);
+ $APIRequest = new APIRequest($TestURL, $PostArray);
+ $APIRequest->DoRequest();
+ $Lines = explode("\r\n",$APIRequest->ShowRawResponse());
+ $T->assert(">",count($Lines),0);
+ $T->assert("==",$Lines[2],"Action: Unknown Action");
+ $T->assert("==",$Lines[8],"ERROR: That Action cannot be found. Did you send the 'Action' parameter? List Actions with Action=DescribeActions");
$T->end();
View
9 script/console → script/api
@@ -1,15 +1,12 @@
#!/usr/bin/env php
<?php
-// I will allow you to use the command line to interact with DAVE. Pass params with standard command line-style input (ie: --key1=val1 --key2=val2 OR -key1=val1 -key2=val2). Variables passed this way will be available in $_GET, $_POST, $_COOKIE, and $_POST.
+// I will allow you to use the command line to interact with DAVE. Pass params with standard command line-style input (ie: --key1=val1 --key2=val2). Variables passed this way will be available in $_GET, $_POST, $_COOKIE, and $_POST.
require("API/helper_functions/parseArgs.php");
$__args = __parseArgs();
-$__args["IP"] = "Console";
-if (empty($__args["OutputType"]))
-{
- $__args["OutputType"] = "CONSOLE";
-}
+if (empty($__args["IP"])){ $__args["IP"] = "localhost"; }
+if (empty($__args["OutputType"])){ $__args["OutputType"] = "CONSOLE"; }
$_GET = $_POST = $_COOKIE = $_REQUEST = $__args ;
unset($__args);
Please sign in to comment.
Something went wrong with that request. Please try again.