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

feat(behat) Add Tests For Contact Templates #12023

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions tests/api/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ default:
paths: [ "%paths.base%/features/MonitoringServerConfiguration.feature" ]
contexts:
- Centreon\Test\Api\Context\MonitoringServerConfigurationContext
contact_templates_configuration:
paths: [ "%paths.base%/features/ConfigurationContactTemplates.feature" ]
contexts:
- Centreon\Test\Behat\Api\Context\ApiContext
72 changes: 72 additions & 0 deletions tests/api/features/ConfigurationContactTemplates.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Feature: List Contact Templates API
In order to use List Contact Templates API
As a logged user
I need to be able to list Access Groups

Background:
Given a running instance of Centreon Web API

Scenario: List Contact Templates as an admin user
Given I am logged in
And the endpoints are described in Centreon Web API documentation (version: 22.10)

When I send a GET request to '/api/latest/configuration/contacts/templates'
Then the response code should be "200"
And the JSON should be equal to:
"""
{
"result": [
{
"id": 19,
"name": "contact_template"
}
],
"meta": {
"page": 1,
"limit": 10,
"search": {},
"sort_by": {},
"total": 1
}
}
"""

Scenario: List Contact Templates as a non-admin user with rights to reach API
Given the following CLAPI import data:
"""
CONTACT;ADD;kev;kev;kev@localhost;Centreon@2022;0;1;en_US;local
CONTACT;setparam;kev;reach_api;1
"""
And I am logged in with "kev"/"Centreon@2022"

When I send a GET request to '/api/latest/configuration/contacts/templates'
Then the response code should be "200"
And the JSON should be equal to:
"""
{
"result": [
{
"id": 19,
"name": "contact_template"
}
],
"meta": {
"page": 1,
"limit": 10,
"search": {},
"sort_by": {},
"total": 1
}
}
"""

Scenario: List Contact Templates as a non-admin user without rights to Reach API
Given the following CLAPI import data:
"""
CONTACT;ADD;kev;kev;kev@localhost;Centreon@2022;0;1;en_US;local
CONTACT;setparam;kev;reach_api;0
"""
And I am logged in with "kev"/"Centreon@2022"

When I send a GET request to '/api/latest/configuration/contacts/templates'
Then the response code should be "403"