Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.6.2, 3.8
-
MOODLE_36_STABLE, MOODLE_38_STABLE
-
MOODLE_38_STABLE
-
MDL-65017-master -
Hide
Test for regressions in the web site
- Create or use a course with one user enrolled as a teacher (t1) and a couple of users enrolled as students (s1 and s2)
- Create a forum in that course
- As an admin, ensure that the maxeditingtime for the posts global setting (Site security settings) is set to 30 minutes
- Now, log in as teacher t1 and create a new discussion
- Delete it and check that it is properly deleted
- Now, create a new discussion
- Reply to the original discussion creating a new post
- Delete that post and check that it is properly deleted
- Reply to the original discussion again
- Now, log-in as the student user s1
- Reply to the original discussion
- Check that the post is created
- Still as s1, edit the post adding some new text
- Check that the post is properly updated
- Still as s1, delete the post you just edited
- Now, log-in as the student user s2
- Reply to the original discussion
- Now, log-in as the teacher again
- Delete the student s2 post and confirm it is properly deleted
- Now, log-in as student user s1
- Reply to the original discussion again
- Now, log-in as student s2
- Reply to the post created by s1
- Log-in as s1 and try to delete his last post (the one you just replied as s2)
- You will see an error because you can't delete a post with replies
- Now, as the admin, lower the maxeditingtime to 1 minute (Site administration > Security > Site security settings)
- Log-in as student s2
- Confirm you are not able to delete any s2 post (you don't see the delete option)
- Now, as the admin, set the maxeditingtime again to 30 minutes
- Log-in as student s2
- Confirm you are able to delete the last post created by s2. Delete it
- Now, obtain the postid (just from the Permlink url for example, the number after the last "p") of the last post created by s1
- Copy and visit the following URL as s2,: http://YOUR_MOODLE_SITE/mod/forum/post.php?delete=POSTID_COPIED_BEFORE
- You will see an error, as a student you can't delete another user's posts
- Now, as the admin, create a new Forum type "a singlesimple discussion"
- Get the automatically created post id from the Reply link for example
- Copy and visit the following URL still as the admin: http://YOUR_MOODLE_SITE/mod/forum/post.php?delete=POSTID_COPIED_BEFORE
- You will get an error, you can't delete the first post of a single discussion
Test for web services
- Create or use a NEW course with one user enrolled as the teacher (t1) and a couple of users enrolled as students (s1 and s2)
- As the admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
- Create a Token in the mobile app service for t1, s1 and s2
- Click on Site administration ► Plugins ► Web services ► Manage tokens
- Create a NEW forum in that course
- As the admin, ensure that the maxeditingtime for the posts global setting (Site security settings) is set to 30 minutes
- Now, log in as the teacher t1 and create a new discussion. Copy the id of the first post in that discussion
- Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- Confirm you receive a status = true and that the discussion is deleted in the web site
- Now, again as t1, create a new discussion
- Reply to the original discussion creating a new post, copy the new post id
- Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- Confirm you receive a status = true and that the post is deleted in the web site
- Reply to the original discussion again
- Now, log-in as the student user s1
- Reply to the original discussion and copy the new post id
- Open the console and execute this new curl request, replacing wstoken with the s1 token, the postid with the one you just copied, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- Confirm you receive a status = true and that the post is deleted in the web site
- Now, log-in as the student user s2
- Reply to the original discussion and copy the post id
- Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- Confirm you receive a status = true and that the s2 post is deleted in the web site
- Now, log-in as student user s1
- Reply to the original discussion again
- Now, log-in as student s2
- Reply to the post created by s1, copy the original s1 post id
- Open the console and execute this new curl request, replacing wstoken with the s1 token, the postid with the one you just copied, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- You will see an error because you can't delete a post with replies
- Now, as the admin, lower the maxeditingtime to 1 minute
- Open the console and execute this new curl request, replacing wstoken with the s2 token, the postid with one of the post created by s2, and the site url with yours.
curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool"
- Confirm receive and error, "You can't delete this post". You can't because the editing time has been reduced and one minute has expired.
- Now, as the admin, set the maxeditingtime again to 30 minutes
- Open the console an execute the last curl request
- Confirm you receive a status = true and that the post is deleted in the web site
ShowTest for regressions in the web site Create or use a course with one user enrolled as a teacher (t1) and a couple of users enrolled as students (s1 and s2) Create a forum in that course As an admin, ensure that the maxeditingtime for the posts global setting (Site security settings) is set to 30 minutes Now, log in as teacher t1 and create a new discussion Delete it and check that it is properly deleted Now, create a new discussion Reply to the original discussion creating a new post Delete that post and check that it is properly deleted Reply to the original discussion again Now, log-in as the student user s1 Reply to the original discussion Check that the post is created Still as s1, edit the post adding some new text Check that the post is properly updated Still as s1, delete the post you just edited Now, log-in as the student user s2 Reply to the original discussion Now, log-in as the teacher again Delete the student s2 post and confirm it is properly deleted Now, log-in as student user s1 Reply to the original discussion again Now, log-in as student s2 Reply to the post created by s1 Log-in as s1 and try to delete his last post (the one you just replied as s2) You will see an error because you can't delete a post with replies Now, as the admin, lower the maxeditingtime to 1 minute (Site administration > Security > Site security settings) Log-in as student s2 Confirm you are not able to delete any s2 post (you don't see the delete option) Now, as the admin, set the maxeditingtime again to 30 minutes Log-in as student s2 Confirm you are able to delete the last post created by s2. Delete it Now, obtain the postid (just from the Permlink url for example, the number after the last "p") of the last post created by s1 Copy and visit the following URL as s2,: http://YOUR_MOODLE_SITE/mod/forum/post.php?delete=POSTID_COPIED_BEFORE You will see an error, as a student you can't delete another user's posts Now, as the admin, create a new Forum type "a singlesimple discussion" Get the automatically created post id from the Reply link for example Copy and visit the following URL still as the admin: http://YOUR_MOODLE_SITE/mod/forum/post.php?delete=POSTID_COPIED_BEFORE You will get an error, you can't delete the first post of a single discussion Test for web services Create or use a NEW course with one user enrolled as the teacher (t1) and a couple of users enrolled as students (s1 and s2) As the admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for t1, s1 and s2 Click on Site administration ► Plugins ► Web services ► Manage tokens Create a NEW forum in that course As the admin, ensure that the maxeditingtime for the posts global setting (Site security settings) is set to 30 minutes Now, log in as the teacher t1 and create a new discussion. Copy the id of the first post in that discussion Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" Confirm you receive a status = true and that the discussion is deleted in the web site Now, again as t1, create a new discussion Reply to the original discussion creating a new post, copy the new post id Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" Confirm you receive a status = true and that the post is deleted in the web site Reply to the original discussion again Now, log-in as the student user s1 Reply to the original discussion and copy the new post id Open the console and execute this new curl request, replacing wstoken with the s1 token, the postid with the one you just copied, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" Confirm you receive a status = true and that the post is deleted in the web site Now, log-in as the student user s2 Reply to the original discussion and copy the post id Open the console and execute this new curl request, replacing wstoken with the t1 token, the postid with the one you just copied, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" Confirm you receive a status = true and that the s2 post is deleted in the web site Now, log-in as student user s1 Reply to the original discussion again Now, log-in as student s2 Reply to the post created by s1, copy the original s1 post id Open the console and execute this new curl request, replacing wstoken with the s1 token, the postid with the one you just copied, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" You will see an error because you can't delete a post with replies Now, as the admin, lower the maxeditingtime to 1 minute Open the console and execute this new curl request, replacing wstoken with the s2 token, the postid with one of the post created by s2, and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_delete_post&wstoken=3af67232a7596ceb658df4db329e5ad6&postid=40' | python -m "json.tool" Confirm receive and error, "You can't delete this post". You can't because the editing time has been reduced and one minute has expired. Now, as the admin, set the maxeditingtime again to 30 minutes Open the console an execute the last curl request Confirm you receive a status = true and that the post is deleted in the web site
Description
New Web Service for deleting posts (and discussions if the post has not parent)
Attachments
- Test for regressions in the web site_Screenshot.png
- 227 kB
- Gladys Basiana
- Test for web services_Screenshot.png
- 488 kB
- Gladys Basiana
Issue Links
- blocks
-
MOBILE-3157 Delete forum posts
-
- Closed
-