...
Expand |
---|
title | Features - Create Service group |
---|
|
Code Block |
---|
Feature: Create service group
Scenario: Successful creation
Given my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7"
When I create service group with attributes:
| name | code |
| "Ультразвукові дослідження в неврології" | "2FA" |
Then no errors should be returned
And request id should be returned
And I should receive requested item
And the name of the requested item should be "Ультразвукові дослідження в неврології"
Scenario: Successful creation with parent group
Given the following service groups exist:
| databaseId | requestAllowed |
| "f4ce3fdf-d49b-426c-9636-8b186db75d73" | false |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7"
When I create service group with attributes:
| name | code | parentGroupId |
| "Ультразвукові дослідження в неврології" | "2FA" | "U2VydmljZUdyb3VwOmY0Y2UzZmRmLWQ0OWItNDI2Yy05NjM2LThiMTg2ZGI3NWQ3Mw==" |
Then no errors should be returned
And request id should be returned
And I should receive requested item
And the databaseId in parentGroup of the requested item should be "f4ce3fdf-d49b-426c-9636-8b186db75d73"
Scenario: Successful creation with deactivated existing code
Given the following service groups exist:
| code | isActive |
| "2FA" | false |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7"
When I create service group with attributes:
| name | code |
| "Ультразвукові дослідження в неврології" | "2FA" |
Then no errors should be returned
And request id should be returned
And I should receive requested item
And the code of the requested item should be "2FA"
Scenario: Create with incorrect scope
Given my scope is "service_catalog:read"
And my consumer ID is "04796283-74b8-4632-9f7f-9e227ae9426e"
When I create service group with attributes:
| name | code |
| "Ультразвукові дослідження в неврології" | "2FA" |
Then the "FORBIDDEN" error should be returned
And request id should be returned
And I should not receive requested item
Scenario: Create with incorrect client
Given my scope is "service_catalog:write"
And my client type is "MSP"
And my consumer ID is "089c0204-a191-4537-ab92-56dca268443c"
When I create service group with attributes:
| name | code |
| "Ультразвукові дослідження в неврології" | "2FA" |
Then the "FORBIDDEN" error should be returned
And request id should be returned
And I should not receive requested item
Scenario Outline: Create with invalid params
Given my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "94e4301f-2d28-4403-b59f-b5865e9ca26f"
When I create service group with attributes:
| name | code |
| <name> | <code> |
Then the "UNPROCESSABLE_ENTITY" error should be returned
And request id should be returned
And I should not receive requested item
Examples:
| name | code |
| "" | "2FA" |
| "Діагностичні інструментальні" | "" |
Scenario: Create with already existing code
Given the following service groups exist:
| code | isActive |
| "2FA" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7"
When I create service group with attributes:
| name | code |
| "Ультразвукові дослідження в неврології" | "2FA" |
Then the "UNPROCESSABLE_ENTITY" error should be returned
And request id should be returned
And I should not receive requested item
Scenario: Create with parent group allowed to request
Given the following service groups exist:
| databaseId | requestAllowed |
| "f4ce3fdf-d49b-426c-9636-8b186db75d73" | true |
And my scope is "service_catalog:write"
And my client type is "NHS"
And my consumer ID is "1ad3c0e6-e2fc-2d3c-a15c-5101874165a7"
When I create service group with attributes:
| name | code | parentGroupId |
| "Ультразвукові дослідження в неврології" | "2FA" | "U2VydmljZUdyb3VwOmY0Y2UzZmRmLWQ0OWItNDI2Yy05NjM2LThiMTg2ZGI3NWQ3Mw==" |
Then the "CONFLICT" error should be returned
And request id should be returned
And I should not receive requested item |
|
...
Filters
Input parameter | Values | Type | Description | Example |
---|
name | | | | |
code | | | | |
requestAllowed | | | | |
parentGroup | | | | |
...
Verify the validity of access token
Check user scope (scope = 'service_catalog:write') in order to perform this action
In case error - generate 401 response
...
Check that all elements in array of code are different where service_groups.is_active = True.
in case of error return 422 error (message `codes are duplicated`)
Validate parent Group
Check on existing parentGroup in Service Groups.
Check exist `Service Groups` by $.service_group[].id.
if invalid - return 422 error (message: "parent Group in Service Group not found")
...
Search `Service Groups` ($.service_group[].id). Check exist any service_group.is_active=FALSE.
if exists - return 422 error (message: "Service Group is not active")
...
Search `Service Groups` ($.service_group[].id). Check exist service_group.request_allowed=TRUE.
if exists - return 422 error (message: "Parent ServiceGroup should not be allowed to request")
...
Create new Service Group
Create new record in Service_groups
Fill data
Name | Source |
---|
id | |
code | $.code |
name | $.name |
is_active | True |
parent_group_id | $.parent_group_id |
request_allowed | $.request_allowed |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
Response structure
API paragraph not found
...