summaryrefslogtreecommitdiffstats
path: root/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-07-28 14:43:35 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-08-01 10:07:51 +0200
commit51d85eb2f84675f292279fc4d5977c958620e802 (patch)
treed98d8c25e9d1d2756807b1e4a1a6b6a40fc93f62 /apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
parent2b895e0c60b6f283cb26b2ca0e18a05497103bc2 (diff)
downloadnextcloud-server-51d85eb2f84675f292279fc4d5977c958620e802.tar.gz
nextcloud-server-51d85eb2f84675f292279fc4d5977c958620e802.zip
expire getShareadSecret job after 30 days
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federation/tests/Controller/OCSAuthAPIControllerTest.php')
-rw-r--r--apps/federation/tests/Controller/OCSAuthAPIControllerTest.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
index 2b231b4fca0..41bfd70bfc5 100644
--- a/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
+++ b/apps/federation/tests/Controller/OCSAuthAPIControllerTest.php
@@ -59,6 +59,9 @@ class OCSAuthAPIControllerTest extends TestCase {
/** @var OCSAuthAPIController */
private $ocsAuthApi;
+ /** @var int simulated timestamp */
+ private $currentTime = 1234567;
+
public function setUp() {
parent::setUp();
@@ -73,15 +76,20 @@ class OCSAuthAPIControllerTest extends TestCase {
$this->logger = $this->getMockBuilder('OCP\ILogger')
->disableOriginalConstructor()->getMock();
- $this->ocsAuthApi = new OCSAuthAPIController(
- 'federation',
- $this->request,
- $this->secureRandom,
- $this->jobList,
- $this->trustedServers,
- $this->dbHandler,
- $this->logger
- );
+ $this->ocsAuthApi = $this->getMockBuilder(OCSAuthAPIController::class)
+ ->setConstructorArgs(
+ [
+ 'federation',
+ $this->request,
+ $this->secureRandom,
+ $this->jobList,
+ $this->trustedServers,
+ $this->dbHandler,
+ $this->logger
+ ]
+ )->setMethods(['getTimestamp'])->getMock();
+
+ $this->ocsAuthApi->expects($this->any())->method('getTimestamp')->willReturn($this->currentTime);
}
@@ -105,7 +113,7 @@ class OCSAuthAPIControllerTest extends TestCase {
if ($ok) {
$this->jobList->expects($this->once())->method('add')
- ->with('OCA\Federation\BackgroundJob\GetSharedSecret', ['url' => $url, 'token' => $token]);
+ ->with('OCA\Federation\BackgroundJob\GetSharedSecret', ['url' => $url, 'token' => $token, 'created' => $this->currentTime]);
$this->jobList->expects($this->once())->method('remove')
->with('OCA\Federation\BackgroundJob\RequestSharedSecret', ['url' => $url, 'token' => $localToken]);
} else {