StreetCode
StreetCode copied to clipboard
[API][Chronology block] The historicalContexts keys id, timelineId and modelState accept invalid data when updating a chronology card
trafficstars
Environment: all Reproducible: always Build found: a7d807f
Preconditions
- Open Postman.
- Choose the PUT method.
- Enter valid endpoints.
- Check-in all mandatory keys for updating Streetcode.
| Issue | Steps to reproduce | Actual result | Expected result | Status |
|---|---|---|---|---|
| 1. Key "id" | 1. In "historicalContexts" block enter: "id": -1, "title": "Революція гідності", "timelineId": timelineItems id, "modelState": 2 2. Click the button Send. |
'200 OK' Context in Chronology block is not updated. | The response returns a status of "400 Bad Request" with the message "When updating "historicalContexts" the "id" key can contain only the numbers of already created Contexts, and the title corresponds to the "id" | Fail |
| 2. Key "timelineId" | 1. Add new information to update a chronology card. In "historicalContexts" block enter: "id": 36, "title": "Друга світова війна", "timelineId": 4444, "modelState": 2 2. Click the button Send. |
'200 OK' Context in Chronology block is not updated. | The response returns a status of "400 Bad Request" with the message "When updating "historicalContexts" the "timelineId" key can contain only the numbers of corresponding timelineItems "id". | Fail |
| 3. Key "modelState" | 1. Add new information to create a new chronology card. For instance, "id": 0, "title": "Борець за справедливість", "description": "Коли прийшов час обирати фах." "date": "2024-02-19T16:06:09.498Z", "dateViewPattern": 3, "modelState": 0, in "historicalContexts": "id": 36, "title": "Друга світова війна", "timelineId": 0, "modelState": 0 2. Click the button Send. |
'200 OK' The new chronology card is created. | '200 OK' The new chronology card is created. | Pass |
| 4. Key "modelState" | 1. Add new information to update the context of the chronology card. For instance, in "historicalContexts": "id": 37, "title": "Чорнобильська катастрофа", "timelineId": numbers of corresponding timelineItems "id", "modelState": 2 2. Click the button Send. |
'200 OK' Context in Chronology block is not updated. | '200 OK' Context in Chronology block is updated. | Fail |
| 5. Key "modelState" | 1. Add new information to update the context of the chronology card. For instance, in "historicalContexts" block enter: "id": 19, "title": "Радянська Україна", "timelineId": 0, "modelState": -1 or 3, 2. Click the button Send. |
'200 OK' Context in Chronology block is deleted. | The response returns a status of "400 Bad Request" with the message "When updating "historicalContexts" the "modelState" key can contain only 0, or 1, or 2." | Fail |
User story: #124 Related bug report: #1334