Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-07-03 10:44:37 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-07-09 14:39:27 +0300
commit1c261675ad3da9804bd9a8c88326103eb2f56bd3 (patch)
treebb8dfba33103e10ca51eef1519dc25c46ec55cd3 /tests/lib/Authentication
parent22de685f546474890ff43bc7d68754afe9fbd6f1 (diff)
Refactor: move remote wipe token logic to RW service
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Authentication')
-rw-r--r--tests/lib/Authentication/Token/RemoteWipeTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php
index e0b3e9fcae9..d5d63b2fb40 100644
--- a/tests/lib/Authentication/Token/RemoteWipeTest.php
+++ b/tests/lib/Authentication/Token/RemoteWipeTest.php
@@ -29,6 +29,7 @@ use OC\Authentication\Exceptions\WipeTokenException;
use OC\Authentication\Token\IProvider as ITokenProvider;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
+use OC\Authentication\Token\IWipeableToken;
use OC\Authentication\Token\RemoteWipe;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
@@ -63,6 +64,35 @@ class RemoteWipeTest extends TestCase {
);
}
+ public function testMarkNonWipableTokenForWipe(): void {
+ $token = $this->createMock(IToken::class);
+ $this->tokenProvider->expects($this->once())
+ ->method('getTokenById')
+ ->with(123)
+ ->willReturn($token);
+
+ $result = $this->remoteWipe->markTokenForWipe(123);
+
+ $this->assertFalse($result);
+ }
+
+ public function testMarkTokenForWipe(): void {
+ $token = $this->createMock(IWipeableToken::class);
+ $this->tokenProvider->expects($this->once())
+ ->method('getTokenById')
+ ->with(123)
+ ->willReturn($token);
+ $token->expects($this->once())
+ ->method('wipe');
+ $this->tokenProvider->expects($this->once())
+ ->method('updateToken')
+ ->with($token);
+
+ $result = $this->remoteWipe->markTokenForWipe(123);
+
+ $this->assertTrue($result);
+ }
+
public function testStartWipingNotAWipeToken() {
$token = $this->createMock(IToken::class);
$this->tokenProvider->expects($this->once())