From 817f2f8f49aec409da832219f43663793e1933a8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 12 Feb 2018 15:08:27 +0100 Subject: adjust swift external storage to new openstack sdk Signed-off-by: Robin Appelman --- apps/files_external/tests/Storage/SwiftTest.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'apps/files_external/tests/Storage/SwiftTest.php') diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 19f185ed033..fdda8baace8 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -27,6 +27,7 @@ namespace OCA\Files_External\Tests\Storage; +use GuzzleHttp\Exception\ClientException; use \OCA\Files_External\Lib\Storage\Swift; /** @@ -40,6 +41,11 @@ class SwiftTest extends \Test\Files\Storage\Storage { private $config; + /** + * @var Swift instance + */ + protected $instance; + protected function setUp() { parent::setUp(); @@ -53,17 +59,15 @@ class SwiftTest extends \Test\Files\Storage\Storage { protected function tearDown() { if ($this->instance) { try { - $connection = $this->instance->getConnection(); - $container = $connection->getContainer($this->config['bucket']); + $container = $this->instance->getContainer(); - $objects = $container->objectList(); - while($object = $objects->next()) { - $object->setName(str_replace('#','%23',$object->getName())); + $objects = $container->listObjects(); + foreach ($objects as $object) { $object->delete(); } $container->delete(); - } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) { + } catch (ClientException $e) { // container didn't exist, so we don't need to delete it } } -- cgit v1.2.3