summaryrefslogtreecommitdiff
path: root/modules/rest/tests/Rest_Controller_Test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-06-18 20:43:14 -0700
committerBharat Mediratta <bharat@menalto.com>2010-06-18 20:43:14 -0700
commit9b788674275c843947d44934a50dd395b515737a (patch)
tree28cf8c7e81935a3dfc311a5e1bdc916fa3471943 /modules/rest/tests/Rest_Controller_Test.php
parent295a42e0f1d5bf5ba1a6a11fe7e222da59dae40b (diff)
Simplify rest::get_access_key($user) to rest::access_key() that
returns just the access key string for the active user. That's how we use the API, so keep it simple.
Diffstat (limited to 'modules/rest/tests/Rest_Controller_Test.php')
-rw-r--r--modules/rest/tests/Rest_Controller_Test.php15
1 files changed, 5 insertions, 10 deletions
diff --git a/modules/rest/tests/Rest_Controller_Test.php b/modules/rest/tests/Rest_Controller_Test.php
index fe83283d..0c8a4a98 100644
--- a/modules/rest/tests/Rest_Controller_Test.php
+++ b/modules/rest/tests/Rest_Controller_Test.php
@@ -21,8 +21,7 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case {
public function setup() {
$this->_save = array($_GET, $_POST, $_SERVER);
- $key = rest::get_access_key(1); // admin user
- $_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $key->access_key;
+ $_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = rest::access_key();
}
public function teardown() {
@@ -83,11 +82,10 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case {
$_SERVER["REQUEST_METHOD"] = "GET";
$_GET["key"] = "value";
- $key = rest::get_access_key(1); // admin user
$this->assert_array_equal_to_json(
array("params" => array("key" => "value"),
"method" => "get",
- "access_key" => $key->access_key,
+ "access_key" => rest::access_key(),
"url" => "http://./index.php/gallery_unit_test"),
test::call_and_capture(array(new Rest_Controller(), "mock")));
}
@@ -96,11 +94,10 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case {
$_SERVER["REQUEST_METHOD"] = "POST";
$_POST["key"] = "value";
- $key = rest::get_access_key(1); // admin user
$this->assert_array_equal_to_json(
array("params" => array("key" => "value"),
"method" => "post",
- "access_key" => $key->access_key,
+ "access_key" => rest::access_key(),
"url" => "http://./index.php/gallery_unit_test"),
test::call_and_capture(array(new Rest_Controller(), "mock")));
}
@@ -110,11 +107,10 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case {
$_SERVER["HTTP_X_GALLERY_REQUEST_METHOD"] = "put";
$_POST["key"] = "value";
- $key = rest::get_access_key(1); // admin user
$this->assert_array_equal_to_json(
array("params" => array("key" => "value"),
"method" => "put",
- "access_key" => $key->access_key,
+ "access_key" => rest::access_key(),
"url" => "http://./index.php/gallery_unit_test"),
test::call_and_capture(array(new Rest_Controller(), "mock")));
}
@@ -124,11 +120,10 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case {
$_SERVER["HTTP_X_GALLERY_REQUEST_METHOD"] = "delete";
$_POST["key"] = "value";
- $key = rest::get_access_key(1); // admin user
$this->assert_array_equal_to_json(
array("params" => array("key" => "value"),
"method" => "delete",
- "access_key" => $key->access_key,
+ "access_key" => rest::access_key(),
"url" => "http://./index.php/gallery_unit_test"),
test::call_and_capture(array(new Rest_Controller(), "mock")));
}