]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix tests 12300/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Sun, 4 Nov 2018 12:21:34 +0000 (13:21 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 6 Nov 2018 07:07:16 +0000 (08:07 +0100)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php
apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php

index 2cb08420f8d3981717c1405011449060529a2001..127d48bd1869911d1104a2237cb4f49c09154d60 100644 (file)
@@ -46,9 +46,6 @@ class DownloadTest extends RequestTestCase {
                $this->assertEquals(stream_get_contents($response->getBody()), 'bar');
        }
 
-       /**
-        * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
-        */
        public function testDownloadWriteLocked() {
                $user = $this->getUniqueID();
                $view = $this->setupUser($user, 'pass');
@@ -57,7 +54,8 @@ class DownloadTest extends RequestTestCase {
 
                $view->lockFile('/foo.txt', ILockingProvider::LOCK_EXCLUSIVE);
 
-               $this->request($view, $user, 'pass', 'GET', '/foo.txt', 'asd');
+               $result = $this->request($view, $user, 'pass', 'GET', '/foo.txt', 'asd');
+               $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
        }
 
        public function testDownloadReadLocked() {
index 5376241c61d9e829fa5b48e0ca9a67c35ea38364..6ac3d66bad3a3c37f5e4462ae84873bf542067df 100644 (file)
@@ -68,9 +68,6 @@ class UploadTest extends RequestTestCase {
                $this->assertEquals(3, $info->getSize());
        }
 
-       /**
-        * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
-        */
        public function testUploadOverWriteReadLocked() {
                $user = $this->getUniqueID();
                $view = $this->setupUser($user, 'pass');
@@ -79,12 +76,10 @@ class UploadTest extends RequestTestCase {
 
                $view->lockFile('/foo.txt', ILockingProvider::LOCK_SHARED);
 
-               $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
+               $result = $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
+               $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
        }
 
-       /**
-        * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
-        */
        public function testUploadOverWriteWriteLocked() {
                $user = $this->getUniqueID();
                $view = $this->setupUser($user, 'pass');
@@ -94,7 +89,8 @@ class UploadTest extends RequestTestCase {
 
                $view->lockFile('/foo.txt', ILockingProvider::LOCK_EXCLUSIVE);
 
-               $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
+               $result = $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
+               $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
        }
 
        public function testChunkedUpload() {
@@ -162,9 +158,6 @@ class UploadTest extends RequestTestCase {
                $this->assertEquals(6, $info->getSize());
        }
 
-       /**
-        * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
-        */
        public function testChunkedUploadOutOfOrderReadLocked() {
                $user = $this->getUniqueID();
                $view = $this->setupUser($user, 'pass');
@@ -184,12 +177,10 @@ class UploadTest extends RequestTestCase {
                $this->assertFalse($view->file_exists('foo.txt'));
 
                // last chunk should trigger the locked error since it tries to assemble
-               $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);
+               $result = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);
+               $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
        }
 
-       /**
-        * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
-        */
        public function testChunkedUploadOutOfOrderWriteLocked() {
                $user = $this->getUniqueID();
                $view = $this->setupUser($user, 'pass');
@@ -209,6 +200,7 @@ class UploadTest extends RequestTestCase {
                $this->assertFalse($view->file_exists('foo.txt'));
 
                // last chunk should trigger the locked error since it tries to assemble
-               $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);
+               $result = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);
+               $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus());
        }
 }