Refactoring Constitution Tests

This commit is contained in:
2020-03-16 22:35:23 +01:00
parent 0e912ef4b1
commit 6b4a6f4075
2 changed files with 34 additions and 15 deletions

View File

@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Constitution Tests" type="JUnit" factoryName="JUnit" show_console_on_std_err="true">
<output_file path="$PROJECT_DIR$/var/log/test/out.log" is_save="true" />
<module name="dcproject.test" />
<useClassPathOnly />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="RunCucumberTest" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea -Dcucumber.filter.tags=&quot;@constitution&quot;" />
<option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<envs>
<env name="SEND_GRID_KEY" value="$SEND_GRID_KEY$" />
</envs>
<dir value="$PROJECT_DIR$" />
<tag value="!online" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -1,17 +1,21 @@
Feature: constitution routes @constitution
Feature: constitution
Scenario: The route for get constitutions must response a 200 Scenario: The route for get constitutions must response a 200
Given I have 3 constitution
When I send a GET request to "/constitutions" When I send a GET request to "/constitutions"
Then the response status code should be 200 Then the response status code should be 200
Scenario: The route for get one constitution must response a 200 and return constitution Scenario: The route for get one constitution must response a 200 and return constitution
When I send a GET request to "/constitutions/0ca489a6-ef68-8bd5-2355-5793d4b3d66c" Given I have constitution with ID "0321c8d1-4ce3-4763-b5f4-a92611d280b4"
When I send a GET request to "/constitutions/0321c8d1-4ce3-4763-b5f4-a92611d280b4"
Then the response status code should be 200 Then the response status code should be 200
And the response should contain object: And the response should contain object:
| id | 0ca489a6-ef68-8bd5-2355-5793d4b3d66c | | id | 0321c8d1-4ce3-4763-b5f4-a92611d280b4 |
Scenario: The route for create constitution must response a 200 and return object Scenario: The route for create constitution must response a 200 and return object
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd" Given I have citizen Henri Poincaré
And I am authenticated as Henri Poincaré
When I send a POST request to "/constitutions" with body: When I send a POST request to "/constitutions" with body:
""" """
{ {
@@ -20,19 +24,10 @@ Feature: constitution routes
"annonymous":true, "annonymous":true,
"titles":[ "titles":[
{ {
"id":"8156b66f-a9c8-4fd9-8375-a8a1f42ccfd2",
"name":"plop", "name":"plop",
"rank":0, "rank":0
"created_by":{
"id":"64b7b379-2298-43ec-b428-ba134930cabd"
}
} }
], ]
"created_by":{
"id":"64b7b379-2298-43ec-b428-ba134930cabd"
},
"created_at":null,
"version_number":null
} }
""" """
Then the response status code should be 200 Then the response status code should be 200