Fix tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2018-07-06 20:15:03 +02:00 committed by Bjoern Schiessle
parent 1b4b4ee188
commit 224a2d6a6c
No known key found for this signature in database
GPG key ID: 2378A753E2BF04F6
2 changed files with 56 additions and 6 deletions

View file

@ -64,6 +64,22 @@ class Test extends TestCase {
'url' => '/saml/selectUserBackEnd',
'verb' => 'GET',
],
[
'name' => 'Settings#getSamlProviderSettings',
'url' => '/settings/providerSettings/{providerId}',
'verb' => 'GET',
'defaults' => [
'providerId' => '1'
]
],
[
'name' => 'Settings#deleteSamlProviderSettings',
'url' => '/settings/providerSettings/{providerId}',
'verb' => 'DELETE',
'defaults' => [
'providerId' => '1'
]
],
],
];
$this->assertSame($expected, $routes);

View file

@ -94,14 +94,18 @@ class AdminTest extends \Test\TestCase {
'require_provisioned_account' => [
'text' => 'Only allow authentication if an account exists on some other backend. (e.g. LDAP)',
'type' => 'checkbox',
'global' => true,
],
'use_saml_auth_for_desktop' => [
'text' => 'Use SAML auth for the Nextcloud desktop clients (requires user re-authentication)',
'type' => 'checkbox',
'global' => true,
],
'allow_multiple_user_back_ends' => [
'text' => $this->l10n->t('Allow the use of multiple user back-ends (e.g. LDAP)'),
'type' => 'checkbox',
'global' => true,
'hideForEnv' => true,
],
];
$attributeMappingSettings = [
@ -134,6 +138,10 @@ class AdminTest extends \Test\TestCase {
'security-general' => $securityGeneral,
'general' => $generalSettings,
'attributeMappings' => $attributeMappingSettings,
'providers' => [
1 => 'Provider 1',
2 => 'Provider 2'
],
];
return $params;
@ -141,7 +149,20 @@ class AdminTest extends \Test\TestCase {
public function testGetFormWithoutType() {
$this->config
->expects($this->once())
->expects($this->at(0))
->method('getAppValue')
->with('user_saml', 'providerIds')
->willReturn('1,2');
$this->config
->expects($this->at(1))
->method('getAppValue')
->willReturn('Provider 1');
$this->config
->expects($this->at(2))
->method('getAppValue')
->willReturn('Provider 2');
$this->config
->expects($this->at(3))
->method('getAppValue')
->with('user_saml', 'type')
->willReturn('');
@ -155,15 +176,28 @@ class AdminTest extends \Test\TestCase {
}
public function testGetFormWithSaml() {
$this->config
->expects($this->at(0))
->method('getAppValue')
->with('user_saml', 'providerIds')
->willReturn('1,2');
$this->config
->expects($this->at(1))
->method('getAppValue')
->willReturn('Provider 1');
$this->config
->expects($this->at(2))
->method('getAppValue')
->willReturn('Provider 2');
$this->config
->expects($this->at(3))
->method('getAppValue')
->with('user_saml', 'type')
->willReturn('saml');
$this->defaults
->expects($this->once())
->method('getName')
->willReturn('Nextcloud');
$this->config
->expects($this->once())
->method('getAppValue')
->with('user_saml', 'type')
->willReturn('saml');
$params = $this->formDataProvider();
$params['type'] = 'saml';