This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ldapLDAPManualImport config added into behat.yml * LdapManualImport and LdapManualImportContext.php.feature files for acceptance test added * feature's background modified * LdapManualImportContext.php accpetance test ok * LdapManuelImport acceptance test enhanced * UtilsContext Class withdrawn * features's name modified * improve acceptance test for ldap manual import * improve ldap manual import acceptance test
- Loading branch information
1 parent
cc87a71
commit 29ede94
Showing
4 changed files
with
148 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: LDAPManualImport | ||
As a company administrator | ||
I want to import manually users | ||
In order to filter the ones who can access to Centreon Web | ||
|
||
Background: | ||
Given I am logged in a Centreon server with a configured ldap | ||
And a LDAP configuration with Users auto import disabled has been created | ||
|
||
Scenario: Search and import one user whose alias contains an accent | ||
Given I search a specific user whose alias contains a special character such as an accent | ||
And the LDAP search result displays the expected alias | ||
When I import the user | ||
Then the user is created | ||
|
||
Scenario: LDAP manually imported user can authenticate to Centreon Web | ||
Given one alias with an accent has been manually imported | ||
When this user logins to Centreon Web | ||
Then he's logged by default on Home page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
|
||
use Centreon\Test\Behat\CentreonContext; | ||
use Centreon\Test\Behat\Administration\LdapConfigurationListingPage; | ||
use Centreon\Test\Behat\Administration\LdapUserImportPage; | ||
use Centreon\Test\Behat\Configuration\ContactConfigurationListingPage; | ||
use Centreon\Test\Behat\External\LoginPage; | ||
|
||
class LdapManualImportContext extends CentreonContext | ||
{ | ||
protected $page; | ||
protected $alias ='centréon-ldap4'; | ||
|
||
/** | ||
* @Given a LDAP configuration with Users auto import disabled has been created | ||
*/ | ||
public function aLdapConfigurationWithUsersAutoImportDisabledHasBeenCreated() | ||
{ | ||
$this->page = new LdapConfigurationListingPage($this); | ||
$this->page = $this->page->inspect('openldap'); | ||
$this->page->setProperties(array( | ||
'enable_authentication' => 1, | ||
'auto_import' => 0, | ||
)); | ||
$this->page = $this->page->save(); | ||
$this->page = $this->page->inspect('openldap'); | ||
if ($this->page->getProperty('auto_import') != 0) { | ||
throw new Exception('Users auto import enabled'); | ||
} | ||
} | ||
|
||
/** | ||
* @Given I search a specific user whose alias contains a special character such as an accent | ||
*/ | ||
public function iSearchASpecificUserWhoseAliasContainsASpecialCharacterSuchAsAnAccent() | ||
{ | ||
$this->page = new LdapUserImportPage($this); | ||
$this->page->setProperties( | ||
array( | ||
'servers' => array( | ||
'openldap' => array( | ||
'checked' => true | ||
) | ||
) | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* @Given the LDAP search result displays the expected alias | ||
*/ | ||
public function theLdapSearchResultDisplaysTheExpectedAlias() | ||
{ | ||
$this->assertFindButton('Search')->click(); | ||
} | ||
|
||
/** | ||
* @When I import the user | ||
*/ | ||
public function iImportTheUser() | ||
{ | ||
$this->spin( | ||
function ($context) { | ||
return $context->getSession()->getPage()->has( | ||
'css', | ||
'input[id^="contact_alias"][value="centréon-ldap4"]' | ||
); | ||
}, | ||
'user to import not found.', | ||
10 | ||
); | ||
$line = $this->assertFind( | ||
'css', | ||
'input[id^="contact_alias"][value="centréon-ldap4"]' | ||
)->getParent()->getParent(); | ||
$this->assertFindIn($line, 'css', 'input[type="checkbox"]')->click(); | ||
$this->assertFindButton('submitA')->click(); | ||
} | ||
|
||
/** | ||
* @Then the user is created | ||
*/ | ||
public function theUserIsCreated() | ||
{ | ||
$this->assertFindLink('centréon-ldap4')->click(); | ||
$this->page = new ContactConfigurationListingPage($this); | ||
$object = $this->page->getEntry($this->alias); | ||
if ($object['alias'] != $this->alias) { | ||
throw new Exception(' contact not created '); | ||
} | ||
} | ||
|
||
/** | ||
* @Given one alias with an accent has been manually imported | ||
*/ | ||
public function oneAliasWithAnAccentHasBeenManuallyImported() | ||
{ | ||
$this->aLdapConfigurationWithUsersAutoImportDisabledHasBeenCreated(); | ||
$this->iSearchASpecificUserWhoseAliasContainsASpecialCharacterSuchAsAnAccent(); | ||
$this->theLdapSearchResultDisplaysTheExpectedAlias(); | ||
$this->iImportTheUser(); | ||
} | ||
|
||
/** | ||
* @When this user logins to Centreon Web | ||
*/ | ||
public function thisUserLoginsToCentreonWeb() | ||
{ | ||
$this->iAmLoggedOut(); | ||
$this->page = new LoginPage($this); | ||
$this->page->login($this->alias, 'centreon-ldap4'); | ||
} | ||
|
||
/** | ||
* @Then he's logged by default on Home page | ||
*/ | ||
public function hesLoggedByDefaultOnHomePage() | ||
{ | ||
$value = $this->assertFind('css', 'div#logli a[class="red"]')->getText(); | ||
if ($value != 'Logout') { | ||
throw new Exception('The user is not logged in'); | ||
} | ||
} | ||
} |