[Pkg-owncloud-commits] [owncloud] 13/23: Added test of OCS privatedata to trigger key duplication

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 15:21:35 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit e7f7ac38c9c678ed08938177e6cc6a1628eb4952
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Fri May 2 13:21:31 2014 +0200

    Added test of OCS privatedata to trigger key duplication
---
 tests/lib/ocs/privatedata.php | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php
index 498ab71..530750f 100644
--- a/tests/lib/ocs/privatedata.php
+++ b/tests/lib/ocs/privatedata.php
@@ -79,6 +79,31 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase
 		$this->assertEquals('updated', $data['value']);
 	}
 
+	public function testSetSameValue() {
+		$_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']);
+
+		// set the same value again
+		$_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']);
+	}
+
 	public function testSetMany() {
 		$_POST = array('value' => 123456789);
 

-- 
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