diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/files/objectstore/swift.php | 32 | ||||
-rw-r--r-- | tests/lib/share/share.php | 5 |
2 files changed, 16 insertions, 21 deletions
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php index 0aaf7d906dd..136d8d18039 100644 --- a/tests/lib/files/objectstore/swift.php +++ b/tests/lib/files/objectstore/swift.php @@ -23,9 +23,11 @@ namespace OCA\ObjectStore\Tests\Unit; use OC\Files\ObjectStore\ObjectStoreStorage; use OC\Files\ObjectStore\Swift as ObjectStoreToTest; -//class Swift extends PHPUnit_Framework_TestCase { class Swift extends \Test\Files\Storage\Storage { + /** + * @var ObjectStoreToTest + */ private $objectStorage; protected function setUp() { @@ -35,9 +37,6 @@ class Swift extends \Test\Files\Storage\Storage { $this->markTestSkipped('objectstore tests are unreliable in some environments'); } - \OC_App::disable('files_sharing'); - \OC_App::disable('files_versions'); - // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); @@ -50,28 +49,15 @@ class Swift extends \Test\Files\Storage\Storage { } // main test user - $userName = 'test'; \OC_Util::tearDownFS(); \OC_User::setUserId(''); \OC\Files\Filesystem::tearDown(); \OC_User::setUserId('test'); - $testContainer = 'oc-test-container-'.substr( md5(rand()), 0, 7); - - $params = array( - 'username' => 'facebook100000330192569', - 'password' => 'Dbdj1sXnRSHxIGc4', - 'container' => $testContainer, - 'autocreate' => true, - 'region' => 'RegionOne', //required, trystack defaults to 'RegionOne' - 'url' => 'http://8.21.28.222:5000/v2.0', // The Identity / Keystone endpoint - 'tenantName' => 'facebook100000330192569', // required on trystack - 'serviceName' => 'swift', //trystack uses swift by default, the lib defaults to 'cloudFiles' if omitted - 'user' => \OC_User::getManager()->get($userName) - ); - $this->objectStorage = new ObjectStoreToTest($params); - $params['objectstore'] = $this->objectStorage; - $this->instance = new ObjectStoreStorage($params); + $config = \OC::$server->getConfig()->getSystemValue('objectstore'); + $this->objectStorage = new ObjectStoreToTest($config['arguments']); + $config['objectstore'] = $this->objectStorage; + $this->instance = new ObjectStoreStorage($config); } protected function tearDown() { @@ -81,6 +67,10 @@ class Swift extends \Test\Files\Storage\Storage { $this->objectStorage->deleteContainer(true); $this->instance->getCache()->clear(); + $users = array('test'); + foreach($users as $userName) { + \OC_User::deleteUser($userName); + } parent::tearDown(); } diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 2ca54390e65..4cb0577cc8c 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -405,6 +405,7 @@ class Test_Share extends \Test\TestCase { $view->mkdir('files_trashbin/files'); $fileInfo = $view->getFileInfo('files/test/sub'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); $fileId = $fileInfo->getId(); $this->assertTrue( @@ -509,6 +510,7 @@ class Test_Share extends \Test\TestCase { $view->mkdir('files/test/sub1/sub2'); $fileInfo = $view->getFileInfo('files/test/sub1'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); $fileId = $fileInfo->getId(); $this->assertTrue( @@ -521,6 +523,7 @@ class Test_Share extends \Test\TestCase { $this->assertEquals(\OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE, $result['permissions']); $fileInfo = $view->getFileInfo('files/test/sub1/sub2'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); $fileId = $fileInfo->getId(); $this->assertTrue( @@ -541,9 +544,11 @@ class Test_Share extends \Test\TestCase { $view->file_put_contents('files/test/sub1/file.txt', 'abc'); $folderInfo = $view->getFileInfo('files/test/sub1'); + $this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo); $folderId = $folderInfo->getId(); $fileInfo = $view->getFileInfo('files/test/sub1/file.txt'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); $fileId = $fileInfo->getId(); $this->assertTrue( |