This task's scope includes adding BDD tests for the workflows of the API's /environment endpoint.
That includes:
- Only authenticated users can access the endpoints (either user token or admin token)
- GET /environment returns all environments created by the authenticated token or all envs if the authenticated token is the admin
- POST /environment/ creates a new environment associated to the authenticated token
- GET /environment/:id returns the details for env id if the environment belongs to the authenticated token or the authenticated token is the admin. Access refused otherwise
- DELETE /environment/:id deletes env id if the environment belongs to the authenticated token or the authenticated token is the admin. Access refused otherwise
- GET /environment/:id/logs returns the logs from all pods associated to env id if the environment belongs to the authenticated token or the authenticated token is the admin. Access refused otherwise
Besides the above scenarios, tests should also cover negative cases, e.g. env doesn't exist, env was deleted, env already exists, etc