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

Feature/behat tests #82

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
139 changes: 131 additions & 8 deletions features/api/job.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,153 @@ Feature: Jobs management
Background:
Given I authenticate myself as admin



#START -----Filter validation-----

Scenario: It should be possible to get all the enabled jobs.
When I send a GET request to "/api/jobs?filter[where][enable]=true"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
And the job should have a enabled with the value "true"
#TODO

Scenario: It should be possible to order jobs by ID, title or abbreviation.
When I send a GET request to "/api/jobs?filter[order][id]"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
When I send a GET request to "/api/jobs?filter[order][abbreviation]"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
When I send a GET request to "/api/jobs?filter[order][title]=User Experience Connector"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
And the job should have a title with the value "User Experience Connector"
#TODO

Scenario: It shoud be possible to find jobs by their abbreviation (an abbreviation may have several jobs).
When I send a GET request to "/api/jobs?filter[where][abbreviation]=DEPT"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
And the job should have an abbreviation with the value "DEPT"
#TODO
#

Scenario: It shoud be possible to find jobs by their mandate
When I send a GET request to "/api/jobs?filter[where][manadte]=/api/mandate/5"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be equal to #TODO
And the job should have a mandate with the value "/api/mandate/5"

#END -----Filter validation-----

#START -----Crud validation-----

Scenario: It should be possible to get all the jobs.
When I send a GET request to "/api/jobs"
Then I should get a paged collection with the context "/api/contexts/Job"
And the JSON node "hydra:totalItems" should be greater than 55

#TODO

# Scenario: It should be possible to get all the enabled jobs.
Scenario: It should be possible to create a new job (1)-With valid values but no mandate
When I send a POST request to "/api/jobs" with body:
| title | |
| abbreviation | |
Then the response status code should be 201
When I send a POST request to "/api/jobs"
Then The last job should have the following nodes:
| title | |
| abbreviation | |
#TODO

# Scenario: It should be possible to order jobs by ID, title or abbreviation.
Scenario: It should be possible to create a new job (2)-With valid values and a mandate
When I send a POST request to "/api/jobs" with body:
| title | |
| abbreviation | |
| mandate | |
Then the response status code should be 201
When I send a POST request to "/api/jobs"
Then The last job should have the following nodes:
| title | |
| abbreviation | |
| mandate | |
#TODO

# Scenario: It should be possible to find a job by its ID or title.
#TODO
Scenario: It should be possible to create a new job (3)-With valid values but non existing mandate
When I send a POST request to "/api/jobs" with body:
| title | |
| abbreviation | |
| mandate | |
Then the response status code should be 422

# Scenario: It shoud be possible to find jobs by their abbreviation (an abbreviation may have several jobs).
Scenario: It should be possible to create a new job (4)-With invalid values
When I send a POST request to "/api/jobs" with body:
| title | |
| abbreviation | |
| mandate | |
Then the response status code should be 422

Scenario: It shoud be possible to see job's informations
When I send a GET request to "/api/jobs/5"
Then the response status code should be 200
And The job should have the following nodes:
| title | |
| abbreviation | |
| mandate | |
#TODO

# Scenario: When creating a new job, it must have at least one mandate. By default is for the ongoing mandate.
Scenario: It should be possible to update a job. (1)-Title or abbreviation
When I send a PUT request to "/api/jobs/5" with body:
| title | |
| abbreviation | |
#TODO
Then the response status code should be 202
When I send a POST request to "/api/jobs/5"
And The job should have the following nodes:
| title | |
| abbreviation | |
| mandate | |
#TODO

# Scenario: It should be possible to update a job.
Scenario: It should be possible to update a job. (2)-Mandate
When I send a PUT request to "/api/jobs/5" with body:
| title | |
| abbreviation | |
#TODO
When I send a POST request to "/api/jobs/5"
And The job should have the following nodes:
| mandate | |
#TODO
When I send a POST request to "/api/jobs/5"
And The job should have the following nodes:
| title | |
| abbreviation | |
| mandate | |
#TODO

# Scenario: It should be possible to delete a job.
Scenario: It should be possible to update a job. (1)-Title or abbreviation
When I send a PUT request to "/api/jobs/5" with body:
#TODO

Scenario: It should be possible to delete a job.
When I send a DELETE request to "/api/jobs/5"
Then the response status code should be 202
When I send a GET request to "/api/jobs/5"
Then the response status code should be 404
check that the deleting of a job does not destroy the user or the mandate
check that the deletion of a job is reflected in the mandate and user
When I send a GET request to "/api/users/??"
Then the response should be 200
And the user has no reference to "/api/jobs/5"
When I send a GET request to "/api/mandates/??"
Then the response should be 200
And the mandate has no reference to "/api/jobs/5"

#END -----Crud validation-----
126 changes: 92 additions & 34 deletions features/api/mandate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,95 @@ Feature: Mandates management
New jobs are created for the current mandate.
A user may have one or several mandate, with or without a job.

# Scenario: If one list all the mandates, there it at least one mandate: the current one.
# #TODO
#
# Scenario: A mandate may have users.
# #TODO
#
# Scenario: It should be possible to list all the mandates.
# #TODO
#
# Scenario: It should be possible to list all the members of a given mandate.
# #TODO
#
# Scenario: It should not be possible to create a mandate unless it starts at the current year. The ending date
# should then be during the next year and may be omitted.
# #TODO
#
# Scenario: If not ending date is given for a mandate, it ends at the end of the next year.
# #TODO
#
# Scenario: If no new mandate has be created, a new one is automatically created and keep all the admin users as if
# they have a new mandate.
# #TODO
#
# Scenario: It should not be possible to delete a mandate.
# #TODO
#
# Scenario: A new member can be added to a mandate even if the mandate already ended.
# #TODO
#
# Scenario: A member may be deleted from a mandate even if the mandate already ended.
# #TODO
#
# Scenario: Once a mandate created, the dates may change but must be of the same year.
# #TODO
#START -----Filter validation-----

#END -----Filter validation-----

#START -----Crud validation-----

Scenario: It should be possible to create a new mandate
When I send a POST request to "/api/mandes/5" with body:
| name | |
| startAt | |
| endAT | |
Then the response status code should be 200
When I send a GET request to "/api/mandes/5" #TODO
Then the response status code should be 200
And the JSON response should have the following nodes:
| name | |
| startAt | |
| endAT | |
#TODO

Scenario: Once a mandate created, the dates may change but must be of the same year.
When I send a POST request to "/api/mandates/5" with body:
| name | |
| startAt | |
| endAT | |
Then the response status code should be 401
And the JSON should be equal to:
"""
{
"code": 401,
"message": "Invalid date modification"
}
"""

Scenario: It should be possible to list all the mandates.
When I send a GET request to "/api/mandates"
Then the response status code should be 200
And I should get a paged collection with the context "/api/contexts/Mandate"

Scenario: It should be possible to get curent mandate
When I send a GET request to "/api/mandates/curent"
Then the response status code should be 200
And the JSON response should have the following nodes:
#TODO

Scenario: It should be possible to update mandate
When I send a PUT request to "/api/mandates/5" with body:
| name | |
| startAt | |
| endAT | |
Then the response status code should be 202
When I send a GET request to "/api/mandates/5"
Then the response status code should be 200
And the JSON response should have the following nodes:
| name | |
| startAt | |
| endAT | |
#TODO

Scenario: It should not be possible to delete a mandate.
When I send a DELETE request to "/api/mandates/5"
Then the response status code should be 400
When I send a GET request to "/api/mandates/5"
Then the response status code should be 400
#TODO
#END -----Crud validation-----

#START -----Spec validation-----

Scenario: It should be possible to add user to a given mandate
#TODO

Scenario: A mandate may have users.
When I send a GET request to "/api/mandates/5"
Then the response status code should be 200
And the JSON node "hydra:totalItems" should be equal to #TODO
When I send #add an user
Then the response status code should be 200
And the JSON node "hydra:totalItems" should be equal to #TODO
#TODO

Scenario: If not ending date is given for a mandate, it ends at the end of the next year.
#TODO

Scenario: A new member can be added to a mandate even if the mandate already ended.
#TODO

Scenario: A member may be deleted from a mandate even if the mandate already ended.
#TODO

#END -----Spec validation-----

64 changes: 38 additions & 26 deletions features/api/student-convention.feature
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
@job
Feature: Jobs management
The job of a user is the job he has occupied for a given mandate.
A job must belong to a mandate.
At each new mandate, the jobs available are the job enabled.
A job may be left empty.
New jobs are created for the current mandate.

Feature: Student-convention
this refere to an offial document
a user may have a student convention


Background:
Given I authenticate myself as admin

Scenario: I should be able to access to a student collection
# When I send a GET request to "/api/student-conventions/1"
# Then I get a resource page with the context "api/contexts/StudentConvention"
# Then the JSON node ("[^"]+"|'[^']+'|\w+([.,]\w+)) should be equal to ("[^"]+"|'[^']+'|\w+([.,]\w+))
#START -----Filter validation-----

#TODO
Scenario: get all student convention for a mandate
#TODO

# Scenario: It should be possible to get all the enabled jobs.
#TODO
Scenario: get all student without student convention for a mandate
#TODO

# Scenario: It should be possible to order jobs by ID, title or abbreviation.
#TODO
Scenario: get all contractor without student convention (ie anomaly)
#TODO

# Scenario: It should be possible to find a job by its ID or title.
#TODO
#END -----Filter validation-----

# Scenario: It shoud be possible to find jobs by their abbreviation (an abbreviation may have several jobs).
#TODO

# Scenario: When creating a new job, it must have at least one mandate. By default is for the ongoing mandate.
#TODO
#START -----Crud validation-----

# Scenario: It should be possible to update a job.
#TODO
Scenario: I should be able to access to a student convention
# When I send a GET request to "/api/student-conventions/1"
# Then I get a resource page with the context "api/contexts/StudentConvention"
# Then the JSON node ("[^"]+"|'[^']+'|\w+([.,]\w+)) should be equal to ("[^"]+"|'[^']+'|\w+([.,]\w+))

# Scenario: It should be possible to delete a job.
#TODO
Scenario: It should be possible to create a student-convention (only related with an existing user)
When I send a POST request to "/api/student-convention" with body:
#TODO

Scenario: It should be possible edit student convention
When I send a PUT request to "/api/student-convention/ADMNIM20130112" with body:

Then the response status code should be 202
When I send a GET request to "/api/student-convention/ADMNIM20130112"
Then the response status code should be 400
And The JSON should have the following nodes:

#TODO

Scenario: It should be possible to delete student convention
When I send a DELETE request to "/api/student-convention/ADMNIM20130112"
Then the response status code should be 202
When I send a GET request to "/api/student-convention/ADMNIM20130112"
Then the response status code should be 404
#END -----Crud validation-----
Loading