Refactoring Citizen Tests

This commit is contained in:
2020-03-16 13:55:25 +01:00
parent 68238494e5
commit 561905f7ab
3 changed files with 75 additions and 113 deletions

View File

@@ -1,31 +1,35 @@
@citizen
Feature: citizens routes
Scenario: The route for get citizens must response a 200
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
Given I have citizen Jean Perrin with ID "5267a5c6-af42-4a02-aa2b-6b71d2e43973"
And I am authenticated as Jean Perrin
When I send a GET request to "/citizens"
Then the response status code should be 200
Scenario: The route for get one citizen must response a 200 and return citizen
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a GET request to "/citizens/6434f4f9-f570-f22a-c134-8668350651ff"
Given I have citizen Linus Pauling with ID "47a05c0f-7329-46c3-a7d0-325db37e9114"
Given I am authenticated as Linus Pauling
When I send a GET request to "/citizens/47a05c0f-7329-46c3-a7d0-325db37e9114"
Then the response status code should be 200
And the response should contain object:
| id | 6434f4f9-f570-f22a-c134-8668350651ff |
| id | 47a05c0f-7329-46c3-a7d0-325db37e9114 |
Scenario: Can get connected citizen
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
Given I have citizen Henri Becquerel with ID "47356809-c8ef-4649-8b99-1c5cb9886d38"
Given I am authenticated as Henri Becquerel
When I send a GET request to "/citizens/current"
Then the response status code should be 200
And the response should contain object:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| id | 47356809-c8ef-4649-8b99-1c5cb9886d38 |
@online
Scenario: Can be connect with SSO
Given I have citizen:
Given I have citizen
| id | c606110c-ff0e-4d09-a79e-74632d7bf7bd |
| firstName | John |
| lastName | Doe |
| email | fabrice.lecomte.be@gmail.com |
| firstName | Leonhard |
| lastName | Euler |
When I send a POST request to "/sso" with body:
"""
{
@@ -36,8 +40,9 @@ Feature: citizens routes
Then the response status code should be 204
Scenario: Can be change my password
Given I am authenticated as Joe Patate with id "c211dca6-aa21-45c2-95ba-c7f2179ee37e"
When I send a PUT request to "/citizens/c211dca6-aa21-45c2-95ba-c7f2179ee37e/password/change" with body:
Given I have citizen Georges Charpak with ID "0c966522-4071-43e5-a3ca-cfff2557f2cf"
And I am authenticated as Georges Charpak
When I send a PUT request to "/citizens/0c966522-4071-43e5-a3ca-cfff2557f2cf/password/change" with body:
"""
{
"old_password": "azerty",
@@ -47,8 +52,10 @@ Feature: citizens routes
Then the response status code should be 201
Scenario: If a send bad request when a change password, that return a 400 Bad request
Given I am authenticated as Joe Carotte with id "19110bb5-58a2-4ef1-9497-0207d4b4f48f"
When I send a PUT request to "/citizens/19110bb5-58a2-4ef1-9497-0207d4b4f48f/password/change" with body:
Given I have citizen Louis Breguet with ID "6cf2a19d-d15d-4ee5-b2a9-907afd26b525"
And I am authenticated as Louis Breguet
When I send a PUT request to "/citizens/6cf2a19d-d15d-4ee5-b2a9-907afd26b525/password/change" with body:
"""
{
"plup": "azerty",