Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

ContactGroupConfiguration added #5372

Merged
merged 9 commits into from
Jul 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ default:
contexts:
- HostConfigurationContext

contact_group_configuration:
paths: [ %paths.base%/features/ContactGroupConfiguration.feature ]
contexts:
- ContactGroupConfigurationContext

host_duplication_check:
paths: [ %paths.base%/features/HostDuplicationCheck.feature ]
contexts:
Expand Down
12 changes: 12 additions & 0 deletions features/ContactGroupConfiguration.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: ContactGroupConfiguration
As a Centreon admin
I want to modify an host
To see if the modification is saved on the contact group page

Background:
Given I am logged in a Centreon server
And a contact group is configured

Scenario: Edit a contact group
When I update the contact group properties
Then the contact group properties are updated
8 changes: 4 additions & 4 deletions features/bootstrap/ContactConfigurationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ContactConfigurationContext extends CentreonContext
{
private $currentPage;
private $initialProperties = (array(
private $initialProperties = array(
'name' => 'contactName',
'alias' => 'contactAlias',
'email' => 'contact@localhost',
Expand All @@ -17,16 +17,16 @@ class ContactConfigurationContext extends CentreonContext
'dn' => 'contactDN',
'host_notification_period' => 'workhours',
'service_notification_period' => 'nonworkhours'
));
private $updatedProperties = (array(
);
private $updatedProperties = array(
'name' => 'modifiedName',
'alias' => 'modifiedAlias',
'email' => 'modified@localhost',
'admin' => 1,
'dn' => 'modifiedDn',
'host_notification_period' => 'workhours',
'service_notification_period' => 'nonworkhours'
));
);

/**
* @Given a contact is configured
Expand Down
96 changes: 96 additions & 0 deletions features/bootstrap/ContactGroupConfigurationContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

use Centreon\Test\Behat\CentreonContext;
use Centreon\Test\Behat\Configuration\ContactGroupsConfigurationPage;
use Centreon\Test\Behat\Configuration\ContactGroupConfigurationListingPage;
use Centreon\Test\Behat\Configuration\ContactConfigurationPage;
use Centreon\Test\Behat\Administration\ACLGroupConfigurationPage;

class ContactGroupConfigurationContext extends CentreonContext
{
protected $currentPage;

protected $initialProperties = array(
'name' => 'contactGroupName',
'alias' => 'contactGroupAlias',
'status' => 0,
'comments' => 'contactGroupComment'
);

protected $updatedProperties = array(
'name' => 'contactGroupNameChanged',
'alias' => 'contactGroupAliasChanged',
'contacts' => 'contactName',
'acl' => 'aclGroupName',
'status' => 1,
'comments' => 'contactGroupCommentChanged'
);

protected $aclGroup = array(
'group_name' => 'aclGroupName',
'group_alias' => 'aclGroupAlias'
);

protected $contact = array(
'name' => 'contactName',
'alias' => 'contactAlias',
'email' => 'contact@localhost',
'password' => 'pwd',
'password2' => 'pwd',
'admin' => 0
);

/**
* @Given a contact group is configured
*/
public function aContactGroupIsConfigured()
{
$this->currentPage = new ContactGroupsConfigurationPage($this);
$this->currentPage->setProperties($this->initialProperties);
$this->currentPage->save();
}

/**
* @When I update the contact group properties
*/
public function iConfigureTheContactGroupProperties()
{
$this->currentPage = new ContactConfigurationPage($this);
$this->currentPage->setProperties($this->contact);
$this->currentPage->save();
$this->currentPage = new ACLGroupConfigurationPage($this);
$this->currentPage->setProperties($this->aclGroup);
$this->currentPage->save();
$this->currentPage = new ContactGroupConfigurationListingPage($this);
$this->currentPage = $this->currentPage->inspect($this->initialProperties['name']);
$this->currentPage->setProperties($this->updatedProperties);
$this->currentPage->save();
}

/**
* @Then the contact group properties are updated
*/
public function theContactGroupPropertiesAreUpdated()
{
$this->tableau = array();
try {
$this->spin(
function ($context) {
$this->currentPage = new ContactGroupConfigurationListingPage($this);
$this->currentPage = $this->currentPage->inspect($this->updatedProperties['name']);
$object = $this->currentPage->getProperties();
foreach ($this->updatedProperties as $key => $value) {
if ($value != $object[$key]) {
$this->tableau[] = $key;
}
}
return count($this->tableau) == 0;
},
"Some properties are not being updated : ",
5
);
} catch (\Exception $e) {
throw new \Exception("Some properties are not being updated : " . implode(',', $this->tableau));
}
}
}