-
Notifications
You must be signed in to change notification settings - Fork 240
Ldap manual import #5381
Ldap manual import #5381
Changes from 5 commits
1518017
65e8b05
15ed97c
1753313
a72490e
0044128
35c110e
ceb1276
c19da1e
63d0159
baa16ca
c3324b6
a0350ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Feature: LDAP_Manual_Import | ||
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 | ||
And a LDAP configuration has been created | ||
And LDAP authentication is enabled | ||
And users auto import is disabled | ||
|
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
|
||
use Centreon\Test\Behat\CentreonContext; | ||
use Centreon\Test\Behat\Administration\LdapConfigurationListingPage; | ||
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 has been created | ||
*/ | ||
public function aLdapConfigurationHasBeenCreated() | ||
{ | ||
$this->launchCentreonWebContainer('web_openldap'); | ||
$this->iAmLoggedIn(); | ||
|
||
$this->page = new LdapConfigurationListingPage($this); | ||
$this->page = $this->page->inspect('openldap'); | ||
$this->page->setProperties(array( | ||
'enable_authentification' => 1, | ||
'auto_import' => 0, | ||
)); | ||
|
||
$this->page->save(); | ||
} | ||
|
||
/** | ||
* @Given LDAP authentication is enabled | ||
*/ | ||
public function ldapAuthenticationIsDisabled() | ||
{ | ||
$this->page = new LdapConfigurationListingPage($this); | ||
$object = $this->page->getEntry('openldap'); | ||
|
||
if ($object['status'] != 'Enabled') { | ||
throw new Exception(' LDAP authentification is disabled'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fr: authentification |
||
} | ||
} | ||
|
||
/** | ||
* @Given users auto import is disabled | ||
*/ | ||
public function usersAutoImportIsDisabled() | ||
{ | ||
$this->page = new LdapConfigurationListingPage($this); | ||
$this->assertFindLink('openldap')->click(); | ||
$value = $this->assertFind('css', 'input[name="ldap_auto_import[ldap_auto_import]"]')->getValue(); | ||
|
||
if ($value != 0) { | ||
throw new Exception('Users auto import enabled'); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @Given I search a specific user whose alias contains a special character such as an accent | ||
*/ | ||
public function iSearchASpecificUserWhoseAliasContainsASpecialCharacterSuchAsAnAccent() | ||
{ | ||
$this->page = new LdapConfigurationListingPage($this); | ||
$this->assertFindLink('openldap')->click(); | ||
sleep(5); | ||
$this->assertFindButton('Import users manually')->click(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @Given the LDAP search result displays the expected alias | ||
*/ | ||
public function theLdapSearchResultDisplaysTheExpectedAlias() | ||
{ | ||
sleep(5); | ||
$this->assertFindButton('Search')->click(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @When I import the user | ||
*/ | ||
public function iImportTheUser() | ||
{ | ||
sleep(5); | ||
$this->assertFind('css', 'input[name="contact_select[select][3]"]')->click(); | ||
$this->assertFindButton('submitA')->click(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @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) { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
throw new Exception(' contact not created '); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @Given one alias with an accent has been manually imported | ||
*/ | ||
public function oneAliasWithAnAccentHasBeenManuallyImported() | ||
{ | ||
$this->aLdapConfigurationHasBeenCreated(); | ||
$this->ldapAuthenticationIsDisabled(); | ||
$this->usersAutoImportIsDisabled(); | ||
$this->iSearchASpecificUserWhoseAliasContainsASpecialCharacterSuchAsAnAccent(); | ||
$this->theLdapSearchResultDisplaysTheExpectedAlias(); | ||
$this->iImportTheUser(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
/** | ||
* @When this user logins to Centreon Web | ||
*/ | ||
public function thisUserLoginsToCentreonWeb() | ||
{ | ||
$this->iAmLoggedOut(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's not the better way to check login |
||
} | ||
|
||
/** | ||
* @Then he's logged by default on Home page | ||
*/ | ||
public function hesLoggedByDefaultOnHomePage() | ||
{ | ||
$this->page = new LoginPage($this); | ||
$this->page->login($this->alias, 'centreon-ldap4'); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. be careful about blank lines (coding style) |
||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much "And" :
Given I am logged in a Centreon server
And a LDAP configuration has been created
And users auto import is disabled