Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix last tests
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 2, 2021
commit 617528312ab6a899bab78ef5f320571d8c406fd3
14 changes: 7 additions & 7 deletions apps/oauth2/tests/Controller/OauthApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

use OC\Authentication\Exceptions\ExpiredTokenException;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider as TokenProvider;
use OC\Authentication\Token\PublicKeyToken;
use OC\Security\Bruteforce\Throttler;
use OCA\OAuth2\Controller\OauthApiController;
use OCA\OAuth2\Db\AccessToken;
Expand Down Expand Up @@ -238,7 +238,7 @@ public function testGetTokenValidAppToken() {
'validrefresh'
)->willReturn('decryptedToken');

$appToken = new DefaultToken();
$appToken = new PublicKeyToken();
$appToken->setUid('userId');
$this->tokenProvider->method('getTokenById')
->with(1337)
Expand Down Expand Up @@ -267,7 +267,7 @@ public function testGetTokenValidAppToken() {
$this->tokenProvider->expects($this->once())
->method('updateToken')
->with(
$this->callback(function (DefaultToken $token) {
$this->callback(function (PublicKeyToken $token) {
return $token->getExpires() === 4600;
})
);
Expand Down Expand Up @@ -330,7 +330,7 @@ public function testGetTokenValidAppTokenBasicAuth() {
'validrefresh'
)->willReturn('decryptedToken');

$appToken = new DefaultToken();
$appToken = new PublicKeyToken();
$appToken->setUid('userId');
$this->tokenProvider->method('getTokenById')
->with(1337)
Expand Down Expand Up @@ -359,7 +359,7 @@ public function testGetTokenValidAppTokenBasicAuth() {
$this->tokenProvider->expects($this->once())
->method('updateToken')
->with(
$this->callback(function (DefaultToken $token) {
$this->callback(function (PublicKeyToken $token) {
return $token->getExpires() === 4600;
})
);
Expand Down Expand Up @@ -425,7 +425,7 @@ public function testGetTokenExpiredAppToken() {
'validrefresh'
)->willReturn('decryptedToken');

$appToken = new DefaultToken();
$appToken = new PublicKeyToken();
$appToken->setUid('userId');
$this->tokenProvider->method('getTokenById')
->with(1337)
Expand Down Expand Up @@ -454,7 +454,7 @@ public function testGetTokenExpiredAppToken() {
$this->tokenProvider->expects($this->once())
->method('updateToken')
->with(
$this->callback(function (DefaultToken $token) {
$this->callback(function (PublicKeyToken $token) {
return $token->getExpires() === 4600;
})
);
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Lockdown/LockdownManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Test\Lockdown;

use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\PublicKeyToken;
use OC\Lockdown\LockdownManager;
use OCP\ISession;
use Test\TestCase;
Expand All @@ -43,15 +43,15 @@ public function testCanAccessFilesystemDisabled() {
}

public function testCanAccessFilesystemAllowed() {
$token = new DefaultToken();
$token = new PublicKeyToken();
$token->setScope(['filesystem' => true]);
$manager = new LockdownManager($this->sessionCallback);
$manager->setToken($token);
$this->assertTrue($manager->canAccessFilesystem());
}

public function testCanAccessFilesystemNotAllowed() {
$token = new DefaultToken();
$token = new PublicKeyToken();
$token->setScope(['filesystem' => false]);
$manager = new LockdownManager($this->sessionCallback);
$manager->setToken($token);
Expand Down