mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Renamed test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
185bc966e6
commit
2cb9ac26cd
48
tests/Feature/Settings/LdapSettingsTest.php
Normal file
48
tests/Feature/Settings/LdapSettingsTest.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Settings;
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
|
||||||
|
class LdapSettingsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testPermissionRequiredToViewLdapSettings()
|
||||||
|
{
|
||||||
|
$this->actingAs(User::factory()->create())
|
||||||
|
->get(route('settings.ldap.index'))
|
||||||
|
->assertForbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLdapSettingsCanBeSaved()
|
||||||
|
{
|
||||||
|
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.ldap.save', [
|
||||||
|
'ldap_enabled' => 1,
|
||||||
|
'ldap_username_field' => 'samaccountName',
|
||||||
|
'ldap_filter' => 'uid=',
|
||||||
|
]))
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertValid('ldap_enabled')
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
$this->followRedirects($response)->assertSee('alert-success');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLdapSettingsAreValidate()
|
||||||
|
{
|
||||||
|
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->from(route('settings.ldap.index'))
|
||||||
|
->post(route('settings.ldap.save', [
|
||||||
|
'ldap_enabled' => 1,
|
||||||
|
'ldap_username_field' => 'sAMAccountName',
|
||||||
|
'ldap_filter' => '',
|
||||||
|
]))
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.ldap.index'))
|
||||||
|
->assertSessionHasErrors();
|
||||||
|
$this->followRedirects($response)->assertSee('alert-danger');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature\Settings;
|
|
||||||
|
|
||||||
use Tests\TestCase;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
|
|
||||||
class LdapSettingsTests extends TestCase
|
|
||||||
{
|
|
||||||
public function testPermissionRequiredToViewLdapSettings()
|
|
||||||
{
|
|
||||||
$this->actingAs(User::factory()->create())
|
|
||||||
->get(route('settings.ldap.index'))
|
|
||||||
->assertForbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testLdapSettingsCanBeSaved()
|
|
||||||
{
|
|
||||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
|
||||||
->post(route('settings.ldap.save', ['ldap_enabled' => 1]))
|
|
||||||
->assertStatus(302)
|
|
||||||
->assertValid('alert_email')
|
|
||||||
->assertRedirect(route('settings.index'))
|
|
||||||
->assertSessionHasNoErrors();
|
|
||||||
$this->followRedirects($response)->assertSee('alert-success');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue