[Pkg-owncloud-commits] [owncloud] 322/457: Fix sabre directory test cases
David Prévot
taffit at moszumanska.debian.org
Sun Jun 28 20:06:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit b97be0ea02a62a8ed4c58d254714f280e071d16a
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Fri Jun 5 19:04:59 2015 +0200
Fix sabre directory test cases
- rely on a mock subfolder instead of the root
- remove obsolete "Shared" limitation tests which did pass but not for the right
reasons
- added test for the prevention of root deletion
---
tests/lib/connector/sabre/directory.php | 39 +++++++++++++--------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/tests/lib/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php
index a048c7a..c846f10 100644
--- a/tests/lib/connector/sabre/directory.php
+++ b/tests/lib/connector/sabre/directory.php
@@ -20,14 +20,14 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
$this->info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false);
}
- private function getRootDir() {
+ private function getDir($path = '/') {
$this->view->expects($this->once())
->method('getRelativePath')
- ->will($this->returnValue(''));
+ ->will($this->returnValue($path));
$this->info->expects($this->once())
->method('getPath')
- ->will($this->returnValue(''));
+ ->will($this->returnValue($path));
return new \OC\Connector\Sabre\Directory($this->view, $this->info);
}
@@ -35,24 +35,13 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
- public function testCreateSharedFileFails() {
- $dir = $this->getRootDir();
- $dir->createFile('Shared');
- }
-
- /**
- * @expectedException \Sabre\DAV\Exception\Forbidden
- */
- public function testCreateSharedFolderFails() {
- $dir = $this->getRootDir();
- $dir->createDirectory('Shared');
- }
-
- /**
- * @expectedException \Sabre\DAV\Exception\Forbidden
- */
- public function testDeleteSharedFolderFails() {
- $dir = $this->getRootDir();
+ public function testDeleteRootFolderFails() {
+ $this->info->expects($this->any())
+ ->method('isDeletable')
+ ->will($this->returnValue(true));
+ $this->view->expects($this->never())
+ ->method('rmdir');
+ $dir = $this->getDir();
$dir->delete();
}
@@ -68,9 +57,10 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
// but fails
$this->view->expects($this->once())
->method('rmdir')
+ ->with('sub')
->will($this->returnValue(true));
- $dir = $this->getRootDir();
+ $dir = $this->getDir('sub');
$dir->delete();
}
@@ -82,7 +72,7 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
->method('isDeletable')
->will($this->returnValue(false));
- $dir = $this->getRootDir();
+ $dir = $this->getDir('sub');
$dir->delete();
}
@@ -98,9 +88,10 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
// but fails
$this->view->expects($this->once())
->method('rmdir')
+ ->with('sub')
->will($this->returnValue(false));
- $dir = $this->getRootDir();
+ $dir = $this->getDir('sub');
$dir->delete();
}
--
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