viraxslot / online-school-app

Backend for testing purposes.
0 stars 0 forks source link

Admin tries to change the teacher's material - Unexpected error message #67

Open Tatyana-Kravchenko opened 2 years ago

Tatyana-Kravchenko commented 2 years ago

Steps to reproduce Teacher created course (course id: {{courseIdForMaterials}}) POST {{host}}/api/v1/courses Request Body

{
  "title": "How to create test cases1 {{coursePostfix}}",
  "description": "Basic course about test design technique",
  "visible": true,
  "categoryId": {{categoryIdForMaterial}}
}

Teacher added a material in this course POST {{host}}/api/v1/courses/{{courseIdForMaterials}}/materials

{
  "title": "Additional material {{materialPostfix}}",
  "data": "stringstri",
  "order": 2
}

Id the created material was saved in environment {{MaterialIdTeacher}}

Admin tries to change the teacher's material PATCH {{host}}/api/v1/courses/{{CourseIdForChangingTeacher}} Request Body

{
  "id": {{MaterialIdTeacher}},
  "title": "New title {{coursePostfix}}",
  "data": "Test Design techniques 12345",
  "order": 2
}

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 material, you can\'t change/remove it")
});

Actual behavior

  1. { "errors": "Unable to find course record(s)" }
  2. Status code is 404
  3. Response time is less than 1000ms

Expected behavior

  1. Statuse code is 403
  2. Response time is less than 1000ms
  3. The text error message ("You\'re not owner of this material, you can\'t change/remove it") is correct Screenshots If applicable, add screenshots to help explain your problem. image image
Tatyana-Kravchenko commented 2 years ago

There are five cases sharing the same unexpected behavior (404 code and 'Unable to find course record(s)'):

1.Teacher tries to change a course created by another teacher https://github.com/viraxslot/online-school-app/issues/40;

  1. Teacher tries to change a course created by admin https://github.com/viraxslot/online-school-app/issues/26, https://github.com/viraxslot/online-school-app/issues/46
  2. Admin tries to change a course created by teacher https://github.com/viraxslot/online-school-app/issues/32
  3. '404 not found' on admin changing the course created by another admin https://github.com/viraxslot/online-school-app/issues/54
  4. This report is about similar error when Admin tries to change a teacher's material
Tatyana-Kravchenko commented 2 years ago
  1. The same result is appeared when teacher tries to change an admin's material;
  2. The same result is appeared when admin 2 tries to change an admin's material;