69 lines
2.4 KiB
Gherkin
69 lines
2.4 KiB
Gherkin
Feature:
|
|
The CRM system is able to send information about new Clients to the service
|
|
|
|
Background:
|
|
Given there exist following clients:
|
|
| clientId | name | initialBalance | currentBalance | locked |
|
|
| 018edd2e-894a-78d7-b10c-16e05ca933a3 | Kacper | 10000 | 5000 | no |
|
|
| 018ede1e-a587-76a8-88f3-23987a8dade9 | Jacek | 10000 | 60000000 | yes |
|
|
|
|
Scenario: CRM is able to create new clients
|
|
Given the request has the following body:
|
|
"""
|
|
{
|
|
"clientId": "018edd37-c145-7143-ba91-c191084e4fba",
|
|
"name": "Jan",
|
|
"balance": 100000
|
|
}
|
|
"""
|
|
When I send a POST request to "/clients"
|
|
Then the response status should be 201
|
|
And client with id "018edd37-c145-7143-ba91-c191084e4fba" should exist
|
|
And client with id "018edd37-c145-7143-ba91-c191084e4fba" should have balance of 100000
|
|
|
|
Scenario: CRM is able to top up existing client
|
|
Given the request has the following body:
|
|
"""
|
|
{
|
|
"amount": 5000
|
|
}
|
|
"""
|
|
When I send a POST request to "/clients/018edd2e-894a-78d7-b10c-16e05ca933a3/_top-up"
|
|
Then the response status should be 200
|
|
And client with id "018edd2e-894a-78d7-b10c-16e05ca933a3" should have balance of 10000
|
|
|
|
Scenario: CRM should not be able to override existing user
|
|
Given the request has the following body:
|
|
"""
|
|
{
|
|
"clientId": "018edd2e-894a-78d7-b10c-16e05ca933a3",
|
|
"name": "Kacper",
|
|
"balance": 100000
|
|
}
|
|
"""
|
|
When I send a POST request to "/clients"
|
|
Then the response status should be 409
|
|
And client with id "018edd2e-894a-78d7-b10c-16e05ca933a3" should exist
|
|
|
|
Scenario: CRM is able to lock existing client
|
|
Given the request has the following body:
|
|
"""
|
|
{
|
|
"lock": true
|
|
}
|
|
"""
|
|
When I send a POST request to "/clients/018edd2e-894a-78d7-b10c-16e05ca933a3/_lock"
|
|
Then the response status should be 200
|
|
And client with id "018edd2e-894a-78d7-b10c-16e05ca933a3" should be locked
|
|
|
|
Scenario: CRM is able to unlock existing client
|
|
Given the request has the following body:
|
|
"""
|
|
{
|
|
"lock": false
|
|
}
|
|
"""
|
|
When I send a POST request to "/clients/018ede1e-a587-76a8-88f3-23987a8dade9/_lock"
|
|
Then the response status should be 200
|
|
And client with id "018ede1e-a587-76a8-88f3-23987a8dade9" should not be locked
|