Fixed tests

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-10-09 22:15:16 +01:00
parent 3705b91439
commit 710e738e8e

View file

@ -22,10 +22,16 @@ class LdapSettingsTest extends TestCase
'ldap_enabled' => 1, 'ldap_enabled' => 1,
'ldap_username_field' => 'samaccountname', 'ldap_username_field' => 'samaccountname',
'ldap_filter' => 'uid=', 'ldap_filter' => 'uid=',
'ldap_auth_filter_query' => 'uid=',
'ldap_uname' => 'SomeUserField',
'ldap_pword' => 'MyAwesomePassword',
'ldap_basedn' => 'uid=',
'ldap_fname_field' => 'SomeFirstnameField',
'ldap_server' => 'ldaps://ldap.example.com',
])) ]))
->assertStatus(302) ->assertStatus(302)
->assertValid('ldap_enabled') ->assertValid('ldap_enabled')
->assertRedirect(route('settings.index')) ->assertRedirect(route('settings.ldap.index'))
->assertSessionHasNoErrors(); ->assertSessionHasNoErrors();
$this->followRedirects($response)->assertSee('alert-success'); $this->followRedirects($response)->assertSee('alert-success');
} }
@ -37,11 +43,19 @@ class LdapSettingsTest extends TestCase
->post(route('settings.ldap.save', [ ->post(route('settings.ldap.save', [
'ldap_enabled' => 1, 'ldap_enabled' => 1,
'ldap_username_field' => 'sAMAccountName', 'ldap_username_field' => 'sAMAccountName',
'ldap_filter' => 'uid=', 'ldap_filter' => '(uid=)',
])) ]))
->assertStatus(302) ->assertStatus(302)
->assertRedirect(route('settings.ldap.index')) ->assertRedirect(route('settings.ldap.index'))
->assertSessionHasErrors(); ->assertSessionHasErrors([
'ldap_username_field',
'ldap_auth_filter_query',
'ldap_uname',
'ldap_pword',
'ldap_basedn',
'ldap_fname_field',
'ldap_server',
]);
$this->followRedirects($response)->assertSee('alert-danger'); $this->followRedirects($response)->assertSee('alert-danger');
} }