Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teacher tries to add new material with not unique title in his course #63

Open
Tatyana-Kravchenko opened this issue Jul 1, 2022 · 2 comments
Labels
question Further information is requested

Comments

@Tatyana-Kravchenko
Copy link

Tatyana-Kravchenko commented Jul 1, 2022

Steps to reproduce

  1. Teacher added new material in his course (courseId: {{courseIdForMaterials}}, title: Additional material {{materialPostfix}}, data: "data of material. New", order: 3;) POST {{host}}/api/v1/courses/{{courseIdForMaterials}}/materials
  2. Teacher saved in environment title of material as {{NotUniqueTitleTeacher}}

Teacher tries to add new material with title which are existed
Post {{host}}/api/v1/courses/{{courseIdForMaterials}}/materials
Body request:

{
  "title": "{{NotUniqueTitleTeacher}}",
  "data": "data of material. New",
  "order": 3
}

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("Check the text error of is correct", function () {
    const jsonData = pm.response.json();
    pm.expect(jsonData.error).equal("Title of material should be unique")
});

Actual behavior

  1. Status code is 200
  2. Response time is less than 1000 ms
  3. New material with not unique title was added

Expected behavior

  1. Status code is 403
  2. Response time is less than 1000 ms
  3. New material with not unique title wasn't added
  4. Error message (Title of material should be unique) is correct
    Screenshots
    If applicable, add screenshots to help explain your problem.

Bug1HW16

@Tatyana-Kravchenko Tatyana-Kravchenko changed the title Teacher can't add new material with not unique title in his course Teacher tries to add new material with not unique title in his course - Unexpected Status code Jul 1, 2022
@Tatyana-Kravchenko Tatyana-Kravchenko changed the title Teacher tries to add new material with not unique title in his course - Unexpected Status code Teacher tries to add new material with not unique title in his course - Unexpected Behaviour Jul 1, 2022
@viraxslot
Copy link
Owner

@Tatyana-Kravchenko I'd say there is no need to limit teachers with such rule. It's a rare case, but why not? I think it doesn't affect anything.

By the way, it'd be 400 code, not 403. Forbidden is about access rights: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

@viraxslot viraxslot added the question Further information is requested label Jul 15, 2022
@viraxslot viraxslot changed the title Teacher tries to add new material with not unique title in his course - Unexpected Behaviour Teacher tries to add new material with not unique title in his course Jul 15, 2022
@viraxslot
Copy link
Owner

@Tatyana-Kravchenko "Unexpected behavior" doesn't add any useful information. It's obviously unexpected because it's a bug, right? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants