diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-13 16:30:41 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-13 21:54:56 +0100 |
commit | 7785c3752fbfef792cd33dc5da2ee63e8263b9fa (patch) | |
tree | 66b68c5f9ce30ec87c51aebc7d9ffe0c14b30d2f /tests/lib/Share | |
parent | ede723f1b19c4c1afb7627af85c1e2f8d8a31386 (diff) | |
download | nextcloud-server-7785c3752fbfef792cd33dc5da2ee63e8263b9fa.tar.gz nextcloud-server-7785c3752fbfef792cd33dc5da2ee63e8263b9fa.zip |
Remove deprecated HTTPHelper
* Remove the HTTP Helper
* Remove from Server Containter
* Removed legacy share tests that use it
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/Share')
-rw-r--r-- | tests/lib/Share/ShareTest.php | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index 18d1944f193..273482e1759 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -542,53 +542,6 @@ class ShareTest extends \Test\TestCase { ); } - public function dataRemoteShareUrlCalls() { - return [ - ['admin@localhost', 'localhost'], - ['admin@https://localhost', 'localhost'], - ['admin@http://localhost', 'localhost'], - ['admin@localhost/subFolder', 'localhost/subFolder'], - ]; - } - - /** - * @dataProvider dataRemoteShareUrlCalls - * - * @param string $shareWith - * @param string $urlHost - */ - public function testRemoteShareUrlCalls($shareWith, $urlHost) { - $httpHelperMock = $this->getMockBuilder('OC\HTTPHelper') - ->disableOriginalConstructor() - ->getMock(); - $this->overwriteService('HTTPHelper', $httpHelperMock); - - $httpHelperMock->expects($this->at(0)) - ->method('post') - ->with($this->stringStartsWith('https://' . $urlHost . '/ocs/v2.php/cloud/shares'), $this->anything()) - ->willReturn(['success' => false, 'result' => 'Exception']); - $httpHelperMock->expects($this->at(1)) - ->method('post') - ->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v2.php/cloud/shares'), $this->anything()) - ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - - \OC\Share\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith, \OCP\Constants::PERMISSION_READ); - $shares = \OCP\Share::getItemShared('test', 'test.txt'); - $share = array_shift($shares); - - $httpHelperMock->expects($this->at(0)) - ->method('post') - ->with($this->stringStartsWith('https://' . $urlHost . '/ocs/v2.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything()) - ->willReturn(['success' => false, 'result' => 'Exception']); - $httpHelperMock->expects($this->at(1)) - ->method('post') - ->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v2.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything()) - ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - - \OC\Share\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith); - $this->restoreService('HTTPHelper'); - } - /** * @dataProvider dataProviderTestGroupItems * @param array $ungrouped @@ -667,41 +620,6 @@ class ShareTest extends \Test\TestCase { } /** - * Make sure that a user cannot have multiple identical shares to remote users - */ - public function testOnlyOneRemoteShare() { - $httpHelperMock = $this->getMockBuilder('OC\HTTPHelper') - ->disableOriginalConstructor() - ->getMock(); - $this->overwriteService('HTTPHelper', $httpHelperMock); - - $httpHelperMock->expects($this->at(0)) - ->method('post') - ->with($this->stringStartsWith('https://localhost/ocs/v2.php/cloud/shares'), $this->anything()) - ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - - \OC\Share\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost', \OCP\Constants::PERMISSION_READ); - $shares = \OCP\Share::getItemShared('test', 'test.txt'); - $share = array_shift($shares); - - //Try share again - try { - \OC\Share\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost', \OCP\Constants::PERMISSION_READ); - $this->fail('Identical remote shares are not allowed'); - } catch (\Exception $e) { - $this->assertEquals('Sharing test.txt failed, because this item is already shared with foo@localhost', $e->getMessage()); - } - - $httpHelperMock->expects($this->at(0)) - ->method('post') - ->with($this->stringStartsWith('https://localhost/ocs/v2.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything()) - ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - - \OC\Share\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost'); - $this->restoreService('HTTPHelper'); - } - - /** * Test case for #17560 */ public function testAccesToSharedSubFolder() { |