|
|
|
|
@ -110,28 +110,24 @@ class OCSAuthAPIControllerTest extends TestCase { |
|
|
|
|
$token = 'token'; |
|
|
|
|
|
|
|
|
|
/** @var OCSAuthAPIController&MockObject $ocsAuthApi */ |
|
|
|
|
$ocsAuthApi = $this->getMockBuilder(OCSAuthAPIController::class) |
|
|
|
|
->setConstructorArgs( |
|
|
|
|
[ |
|
|
|
|
'federation', |
|
|
|
|
$this->request, |
|
|
|
|
$this->secureRandom, |
|
|
|
|
$this->jobList, |
|
|
|
|
$this->trustedServers, |
|
|
|
|
$this->dbHandler, |
|
|
|
|
$this->logger, |
|
|
|
|
$this->timeFactory, |
|
|
|
|
$this->throttler |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
->onlyMethods(['isValidToken']) |
|
|
|
|
->getMock(); |
|
|
|
|
$ocsAuthApi = new OCSAuthAPIController( |
|
|
|
|
'federation', |
|
|
|
|
$this->request, |
|
|
|
|
$this->secureRandom, |
|
|
|
|
$this->jobList, |
|
|
|
|
$this->trustedServers, |
|
|
|
|
$this->dbHandler, |
|
|
|
|
$this->logger, |
|
|
|
|
$this->timeFactory, |
|
|
|
|
$this->throttler, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->trustedServers |
|
|
|
|
->expects($this->any()) |
|
|
|
|
->method('isTrustedServer')->with($url)->willReturn($isTrustedServer); |
|
|
|
|
$ocsAuthApi->expects($this->any()) |
|
|
|
|
->method('isValidToken')->with($url, $token)->willReturn($isValidToken); |
|
|
|
|
$this->dbHandler->method('getToken') |
|
|
|
|
->with($url) |
|
|
|
|
->willReturn($isValidToken ? $token : 'not $token'); |
|
|
|
|
|
|
|
|
|
if ($ok) { |
|
|
|
|
$this->secureRandom->expects($this->once())->method('generate')->with(32) |
|
|
|
|
|