Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop all dead packages #24816

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 187 files
10 changes: 1 addition & 9 deletions apps/federation/lib/BackgroundJob/GetSharedSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -191,14 +190,7 @@ protected function run($argument) {
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->logException($e, [
'message' => 'Could not connect to ' . $target,
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']);
}
Expand Down
6 changes: 1 addition & 5 deletions apps/federation/lib/BackgroundJob/RequestSharedSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
Expand Down Expand Up @@ -184,10 +183,7 @@ protected function run($argument) {
} catch (RequestException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']);
}
Expand Down
38 changes: 0 additions & 38 deletions apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
namespace OCA\Federation\Tests\BackgroundJob;

use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\BackgroundJob\GetSharedSecret;
use OCA\Federation\TrustedServers;
use OCA\Files_Sharing\Tests\TestCase;
Expand Down Expand Up @@ -298,41 +297,4 @@ public function testRunConnectionError() {

$this->assertTrue($this->invokePrivate($this->getSharedSecret, 'retainJob'));
}

public function testRunRingException() {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';

$argument = ['url' => $target, 'token' => $token];

$this->timeFactory->method('getTime')
->willReturn(42);

$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
->with('/')
->willReturn($source);
$this->httpClient->expects($this->once())->method('get')
->with(
$target . '/ocs/v2.php/apps/federation/api/v1/shared-secret',
[
'query' =>
[
'url' => $source,
'token' => $token,
'format' => 'json',
],
'timeout' => 3,
'connect_timeout' => 3,
]
)->willThrowException($this->createMock(RingException::class));

$this->trustedServers->expects($this->never())->method('addSharedSecret');

$this->invokePrivate($this->getSharedSecret, 'run', [$argument]);

$this->assertTrue($this->invokePrivate($this->getSharedSecret, 'retainJob'));
}
}
37 changes: 0 additions & 37 deletions apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace OCA\Federation\Tests\BackgroundJob;

use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Ring\Exception\RingException;
use OCA\Federation\BackgroundJob\RequestSharedSecret;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http;
Expand Down Expand Up @@ -279,40 +278,4 @@ public function testRunConnectionError() {
$this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
$this->assertTrue($this->invokePrivate($this->requestSharedSecret, 'retainJob'));
}

public function testRunRingException() {
$target = 'targetURL';
$source = 'sourceURL';
$token = 'token';

$argument = ['url' => $target, 'token' => $token];

$this->timeFactory->method('getTime')->willReturn(42);

$this->urlGenerator
->expects($this->once())
->method('getAbsoluteURL')
->with('/')
->willReturn($source);

$this->httpClient
->expects($this->once())
->method('post')
->with(
$target . '/ocs/v2.php/apps/federation/api/v1/request-shared-secret',
[
'body' =>
[
'url' => $source,
'token' => $token,
'format' => 'json',
],
'timeout' => 3,
'connect_timeout' => 3,
]
)->willThrowException($this->createMock(RingException::class));

$this->invokePrivate($this->requestSharedSecret, 'run', [$argument]);
$this->assertTrue($this->invokePrivate($this->requestSharedSecret, 'retainJob'));
}
}