Fix personal security section tests (#15789)

Fix personal security section tests
This commit is contained in:
John Molakvoæ 2019-05-29 14:52:02 +02:00 committed by GitHub
commit 21f9487939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -31,6 +31,7 @@ use OC\Authentication\TwoFactorAuth\Manager as TwoFactorManager;
use OC\Authentication\TwoFactorAuth\ProviderLoader; use OC\Authentication\TwoFactorAuth\ProviderLoader;
use OC\Settings\Personal\Security; use OC\Settings\Personal\Security;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\ISession; use OCP\ISession;
use OCP\IUser; use OCP\IUser;
@ -59,6 +60,9 @@ class SecurityTest extends TestCase {
/** @var ISession|MockObject */ /** @var ISession|MockObject */
private $session; private $session;
/** @var IConfig|MockObject */
private $config;
/** @var IInitialStateService|MockObject */ /** @var IInitialStateService|MockObject */
private $initialStateService; private $initialStateService;
@ -76,6 +80,7 @@ class SecurityTest extends TestCase {
$this->authTokenProvider = $this->createMock(IAuthTokenProvider::class); $this->authTokenProvider = $this->createMock(IAuthTokenProvider::class);
$this->providerLoader = $this->createMock(ProviderLoader::class); $this->providerLoader = $this->createMock(ProviderLoader::class);
$this->userSession = $this->createMock(IUserSession::class); $this->userSession = $this->createMock(IUserSession::class);
$this->config = $this->createMock(IConfig::class);
$this->session = $this->createMock(ISession::class); $this->session = $this->createMock(ISession::class);
$this->initialStateService = $this->createMock(IInitialStateService::class); $this->initialStateService = $this->createMock(IInitialStateService::class);
$this->uid = 'test123'; $this->uid = 'test123';
@ -87,6 +92,7 @@ class SecurityTest extends TestCase {
$this->providerLoader, $this->providerLoader,
$this->userSession, $this->userSession,
$this->session, $this->session,
$this->config,
$this->initialStateService, $this->initialStateService,
$this->uid $this->uid
); );
@ -152,6 +158,15 @@ class SecurityTest extends TestCase {
->method('getProviders') ->method('getProviders')
->with($user) ->with($user)
->willReturn([]); ->willReturn([]);
$this->config->expects($this->once())
->method('getUserValue')
->with(
$this->uid,
'accessibility',
'theme',
false
)
->willReturn(false);
$form = $this->section->getForm(); $form = $this->section->getForm();
@ -160,6 +175,7 @@ class SecurityTest extends TestCase {
'twoFactorProviderData' => [ 'twoFactorProviderData' => [
'providers' => [], 'providers' => [],
], ],
'themedark' => false,
]); ]);
$this->assertEquals($expected, $form); $this->assertEquals($expected, $form);
} }