Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-31 14:09:52 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-31 14:09:52 +0400
commit43d71aada89abfaa8b1989874af5f4d7773c0278 (patch)
treeee4e75d61392e33702f7443493332f1fcb9b8312 /tests
parentaae6e769266f516408d1c1c578e64985c2f41fd2 (diff)
testing update and delete
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/ocs/privatedata.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php
index 423bb2c96b6..ea8413734f1 100644
--- a/tests/lib/ocs/privatedata.php
+++ b/tests/lib/ocs/privatedata.php
@@ -55,6 +55,30 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase
$this->assertOcsResult(1, $result);
}
+ public function testSetExisting() {
+ $_POST = array('value' => 123456789);
+ $params = array('app' => $this->appKey, 'key' => 'k-10');
+ $result = OC_OCS_Privatedata::set($params);
+ $this->assertEquals(100, $result->getStatusCode());
+
+ $result = OC_OCS_Privatedata::get($params);
+ $this->assertOcsResult(1, $result);
+ $data = $result->getData();
+ $data = $data[0];
+ $this->assertEquals('123456789', $data['value']);
+
+ $_POST = array('value' => 'updated');
+ $params = array('app' => $this->appKey, 'key' => 'k-10');
+ $result = OC_OCS_Privatedata::set($params);
+ $this->assertEquals(100, $result->getStatusCode());
+
+ $result = OC_OCS_Privatedata::get($params);
+ $this->assertOcsResult(1, $result);
+ $data = $result->getData();
+ $data = $data[0];
+ $this->assertEquals('updated', $data['value']);
+ }
+
public function testSetMany() {
$_POST = array('value' => 123456789);
@@ -74,6 +98,21 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase
$this->assertOcsResult(2, $result);
}
+ public function testDelete() {
+ $_POST = array('value' => 123456789);
+
+ // set key 'k-1'
+ $params = array('app' => $this->appKey, 'key' => 'k-3');
+ $result = OC_OCS_Privatedata::set($params);
+ $this->assertEquals(100, $result->getStatusCode());
+
+ $result = OC_OCS_Privatedata::delete($params);
+ $this->assertEquals(100, $result->getStatusCode());
+
+ $result = OC_OCS_Privatedata::get($params);
+ $this->assertOcsResult(0, $result);
+ }
+
/**
* @dataProvider deleteWithEmptyKeysProvider
*/