clear up tests a bit

This commit is contained in:
Robin Appelman 2015-09-08 15:33:52 +02:00 committed by Thomas Müller
parent 8fa4ebaf6d
commit 5247a0685d
1 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,8 @@
namespace Test\Connector\Sabre\RequestTest;
use OC\AppFramework\Http;
class UploadTest extends RequestTest {
public function testBasicUpload() {
$user = $this->getUniqueID();
@ -16,7 +18,7 @@ class UploadTest extends RequestTest {
$this->assertFalse($view->file_exists('foo.txt'));
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
$this->assertEquals(201, $response->getStatus());
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus());
$this->assertTrue($view->file_exists('foo.txt'));
$this->assertEquals('asd', $view->file_get_contents('foo.txt'));
@ -33,7 +35,7 @@ class UploadTest extends RequestTest {
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt', 'asd');
$this->assertEquals(204, $response->getStatus());
$this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus());
$this->assertEquals('asd', $view->file_get_contents('foo.txt'));
$info = $view->getFileInfo('foo.txt');
@ -53,7 +55,7 @@ class UploadTest extends RequestTest {
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-1', 'bar', ['OC-Chunked' => '1']);
$this->assertEquals(201, $response->getStatus());
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus());
$this->assertTrue($view->file_exists('foo.txt'));
$this->assertEquals('asdbar', $view->file_get_contents('foo.txt'));
@ -70,12 +72,12 @@ class UploadTest extends RequestTest {
$view->file_put_contents('foo.txt', 'bar');
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);
$this->assertEquals(201, $response->getStatus());
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus());
$this->assertEquals('bar', $view->file_get_contents('foo.txt'));
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-1', 'bar', ['OC-Chunked' => '1']);
$this->assertEquals(201, $response->getStatus());
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus());
$this->assertEquals('asdbar', $view->file_get_contents('foo.txt'));
@ -91,7 +93,7 @@ class UploadTest extends RequestTest {
$this->assertFalse($view->file_exists('foo.txt'));
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-1', 'bar', ['OC-Chunked' => '1']);
$this->assertEquals(201, $response->getStatus());
$this->assertEquals(Http::STATUS_CREATED, $response->getStatus());
$this->assertFalse($view->file_exists('foo.txt'));
$response = $this->request($view, $user, 'pass', 'PUT', '/foo.txt-chunking-123-2-0', 'asd', ['OC-Chunked' => '1']);