also verify cache in dav upload tests

This commit is contained in:
Robin Appelman 2015-08-12 15:18:30 +02:00 committed by Thomas Müller
parent 6386327150
commit 80f054ddd3
1 changed files with 21 additions and 1 deletions

View File

@ -19,18 +19,26 @@ class UploadTest extends RequestTest {
$this->assertEquals(201, $response->getStatus());
$this->assertTrue($view->file_exists('foo.txt'));
$this->assertEquals('asd', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
$this->assertInstanceOf('\OC\Files\FileInfo', $info);
$this->assertEquals(3, $info->getSize());
}
public function testUploadOverWrite() {
$user = $this->getUniqueID();
$view = $this->setupUser($user, 'pass');
$view->file_put_contents('foo.txt', 'bar');
$view->file_put_contents('foo.txt', 'foobar');
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
$this->assertEquals(204, $response->getStatus());
$this->assertEquals('asd', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
$this->assertInstanceOf('\OC\Files\FileInfo', $info);
$this->assertEquals(3, $info->getSize());
}
public function testChunkedUpload() {
@ -49,6 +57,10 @@ class UploadTest extends RequestTest {
$this->assertTrue($view->file_exists('foo.txt'));
$this->assertEquals('asdbar', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
$this->assertInstanceOf('\OC\Files\FileInfo', $info);
$this->assertEquals(6, $info->getSize());
}
public function testChunkedUploadOverWrite() {
@ -66,6 +78,10 @@ class UploadTest extends RequestTest {
$this->assertEquals(201, $response->getStatus());
$this->assertEquals('asdbar', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
$this->assertInstanceOf('\OC\Files\FileInfo', $info);
$this->assertEquals(6, $info->getSize());
}
public function testChunkedUploadOutOfOrder() {
@ -84,5 +100,9 @@ class UploadTest extends RequestTest {
$this->assertTrue($view->file_exists('foo.txt'));
$this->assertEquals('asdbar', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
$this->assertInstanceOf('\OC\Files\FileInfo', $info);
$this->assertEquals(6, $info->getSize());
}
}