[Pkg-owncloud-commits] [owncloud] 35/66: testing update and delete

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 22:49:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.15
in repository owncloud.

commit 606c22d9a7d1534a249e889b64eaf76466ee26b0
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Thu Oct 31 11:09:52 2013 +0100

    testing update and delete
---
 tests/lib/ocs/privatedata.php | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php
index 423bb2c..ea84137 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
 	 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list