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:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-01-29 22:13:23 +0300
committerGitHub <noreply@github.com>2020-01-29 22:13:23 +0300
commit53817f5fc20533d2b9da2ecff6bd96acf21b4e17 (patch)
tree6e91fedd594cdd5d475d72403f52e8997c1e59de /apps/settings/tests
parentca964cfe9fa0c0e5b097e61933d67a45a5fa3b2d (diff)
parent34426a481faa5ff76317295305d7c6fad2c8534f (diff)
Merge pull request #19185 from nextcloud/enh/move_token_logic_to_token_settings
Move can create token logic
Diffstat (limited to 'apps/settings/tests')
-rw-r--r--apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php (renamed from apps/settings/tests/Personal/Security/AuthtokensTest.php)14
-rw-r--r--apps/settings/tests/Settings/Personal/SecurityTest.php6
2 files changed, 12 insertions, 8 deletions
diff --git a/apps/settings/tests/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
index e8eadd38aba..6837fc101c4 100644
--- a/apps/settings/tests/Personal/Security/AuthtokensTest.php
+++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
@@ -25,7 +25,7 @@ declare(strict_types=1);
*
*/
-namespace Test\Settings\Personal\Security;
+namespace OCA\Settings\Tests\Settings\Personal\Security;
use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider as IAuthTokenProvider;
@@ -34,6 +34,7 @@ use OCA\Settings\Personal\Security\Authtokens;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IInitialStateService;
use OCP\ISession;
+use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -45,6 +46,9 @@ class AuthtokensTest extends TestCase {
/** @var ISession|MockObject */
private $session;
+ /** @var IUserSession|MockObject */
+ private $userSession;
+
/** @var IInitialStateService|MockObject */
private $initialStateService;
@@ -59,12 +63,14 @@ class AuthtokensTest extends TestCase {
$this->authTokenProvider = $this->createMock(IAuthTokenProvider::class);
$this->session = $this->createMock(ISession::class);
+ $this->userSession = $this->createMock(IUserSession::class);
$this->initialStateService = $this->createMock(IInitialStateService::class);
$this->uid = 'test123';
$this->section = new Authtokens(
$this->authTokenProvider,
$this->session,
+ $this->userSession,
$this->initialStateService,
$this->uid
);
@@ -93,7 +99,7 @@ class AuthtokensTest extends TestCase {
->method('getToken')
->with('session123')
->willReturn($sessionToken);
- $this->initialStateService->expects($this->once())
+ $this->initialStateService->expects($this->at(0))
->method('provideInitialState')
->with('settings', 'app_tokens', [
[
@@ -117,6 +123,10 @@ class AuthtokensTest extends TestCase {
],
]);
+ $this->initialStateService->expects($this->at(1))
+ ->method('provideInitialState')
+ ->with('settings', 'can_create_app_token', true);
+
$form = $this->section->getForm();
$expected = new TemplateResponse('settings', 'settings/personal/security/authtokens');
diff --git a/apps/settings/tests/Settings/Personal/SecurityTest.php b/apps/settings/tests/Settings/Personal/SecurityTest.php
index 5dfb911716f..bd087afa466 100644
--- a/apps/settings/tests/Settings/Personal/SecurityTest.php
+++ b/apps/settings/tests/Settings/Personal/SecurityTest.php
@@ -32,7 +32,6 @@ use OC\Authentication\TwoFactorAuth\ProviderLoader;
use OCA\Settings\Personal\Security;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
-use OCP\IInitialStateService;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
@@ -41,9 +40,6 @@ use Test\TestCase;
class SecurityTest extends TestCase {
- /** @var IInitialStateService|MockObject */
- private $initialStateService;
-
/** @var IUserManager|MockObject */
private $userManager;
@@ -65,7 +61,6 @@ class SecurityTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->initialStateService = $this->createMock(IInitialStateService::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->providerLoader = $this->createMock(ProviderLoader::class);
$this->userSession = $this->createMock(IUserSession::class);
@@ -73,7 +68,6 @@ class SecurityTest extends TestCase {
$this->uid = 'test123';
$this->section = new Security(
- $this->initialStateService,
$this->userManager,
$this->providerLoader,
$this->userSession,