Steps to reproduce
Teacher 2 created course (id: {{createdTeacher2courseIdforChanging}})
Teacher 2 can find this course using id,
Teacher tries to change this course
Patch{{host}}/api/v1/courses
Request Body:
{
"id": {{createdTeacher2courseIdforChanging}},
"title": "New name of course How to create test cases 1656069936 {{coursePostfix}}",
"description": "Basic course about test design technique",
"visible": true,
"categoryId": {{categoryId}}
}
Tests:
pm.test("Status code is 403", function () {
pm.response.to.have.status(403);
});
pm.test("Response time is less than 1000ms", function () {
pm.expect(pm.response.responseTime).to.be.below(1000);
});
pm.test("Error message is correct", function () {
const body = pm.response.json()
pm.expect(body.errors).to.equal("You\'re not owner of this course, you can\'t change/remove it")
});
Actual behavior
Status code: 404 Not Found
{
"errors": "Unable to find course record(s)"
}
Response time is less than 1000
Expected behavior
Status code: 403
Error: You\'re not owner of this course, you can\'t change/remove it
Response time is less than 1000
Screenshots
If applicable, add screenshots to help explain your problem.
Steps to reproduce Teacher 2 created course (id: {{createdTeacher2courseIdforChanging}}) Teacher 2 can find this course using id,
Teacher tries to change this course Patch{{host}}/api/v1/courses
Request Body: { "id": {{createdTeacher2courseIdforChanging}}, "title": "New name of course How to create test cases 1656069936 {{coursePostfix}}", "description": "Basic course about test design technique", "visible": true, "categoryId": {{categoryId}} } Tests: pm.test("Status code is 403", function () { pm.response.to.have.status(403); });
pm.test("Response time is less than 1000ms", function () { pm.expect(pm.response.responseTime).to.be.below(1000); });
pm.test("Error message is correct", function () { const body = pm.response.json() pm.expect(body.errors).to.equal("You\'re not owner of this course, you can\'t change/remove it") });
Actual behavior Status code: 404 Not Found { "errors": "Unable to find course record(s)" } Response time is less than 1000 Expected behavior Status code: 403 Error: You\'re not owner of this course, you can\'t change/remove it Response time is less than 1000 Screenshots If applicable, add screenshots to help explain your problem.