$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');
$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() {
$this->assertEquals(3, $info->getSize());
}
- /**
- * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
- */
public function testUploadOverWriteReadLocked() {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$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');
$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() {
$this->assertEquals(6, $info->getSize());
}
- /**
- * @expectedException \OCA\DAV\Connector\Sabre\Exception\FileLocked
- */
public function testChunkedUploadOutOfOrderReadLocked() {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$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');
$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());
}
}