Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51887

New Web Service mod_wiki_get_subwiki_pages

XMLWordPrintable

    • MOODLE_29_STABLE
    • MOODLE_31_STABLE
    • MDL-51887-master
    • Hide

      Test collaborative wiki without groups

      1. Create a course with a student and a teacher. The course must have at least one section.
      2. Create two groups in the course and add the student in one of them (not both).
      3. Create a collaborative wiki without groups. Add at least one page to that wiki.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      7. Confirm that you receive a list with the pages of that wiki. Confirm that the pages have the caneditpage attribute set to true and they include the page contents.

      Test individual wiki without groups

      1. Now create an individual wiki without groups. As the student, add at least 1 page to that wiki.
      2. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the student's userid.
        • You need to replace the wstoken, wikiid (the wiki instance value), userid and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&userid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      3. Confirm that you receive a list with the pages of the user. Confirm that the pages have the caneditpage attribute set to true.
      4. Perform the request again but using the teacher's userid. Confirm that you receive an error of type cannotviewpage.

      Test collaborative wiki with visible groups

      1. Now create a new collaborative wiki but using visible groups. Create at least 1 page per group.
      2. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the groupid the student belongs to.
        • You need to replace the wstoken, wikiid (the wiki instance value), groupid and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=6&groupid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      3. Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true.
      4. Now perform another request but with the other group (the one the user doesn't belong to).
      5. Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to false.

      Test collaborative wiki with separate groups

      1. Now create a new collaborative wiki but using separate groups. Create at least 1 page per group.
      2. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the groupid the student belongs to.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=4&groupid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      3. Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true.
      4. Now perform another request but with the other group (the one the user doesn't belong to).
      5. Confirm that you receive an error of type cannotviewpage.
      6. Now create a token for the teacher user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Now perform the request again using the teacher WS token and a group ID the teacher doesn't belong to.
      8. Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true.

      Test sort params

      1. Now we have to test that the sort params work, we'll use the first wiki (collaborative without groups). If it only has one page, add at least one more page to it. Please make the title of one of the new pages start with "AAA" (so it's the first in alphabetical order).
      2. Do a CURL REST call using the student's token. We won't specify sort params for now.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      3. Confirm that the pages are ordered alphabetically by title and that the firstpage has the value firstpage set to true, while the other pages have it set to false.
      4. Now do a CURL REST call simulating a WS client but using sort params. We will sort it by id.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179&options%5Bsortby%5D=id' --compressed

      5. Confirm that the pages are ordered by ID and that the firstpage has the value firstpage set to true, while the other pages have it set to false.
      6. Finally, we'll check the includecontent option. Do a CURL REST call simulating a WS client but using includecontent param set to 0 (false).

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179&options%5Bincludecontent%5D=0' --compressed

      7. Check that the returned pages don't include content.
      Show
      Test collaborative wiki without groups Create a course with a student and a teacher. The course must have at least one section. Create two groups in the course and add the student in one of them (not both). Create a collaborative wiki without groups. Add at least one page to that wiki. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user. Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive a list with the pages of that wiki. Confirm that the pages have the caneditpage attribute set to true and they include the page contents. Test individual wiki without groups Now create an individual wiki without groups. As the student, add at least 1 page to that wiki. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the student's userid . You need to replace the wstoken, wikiid (the wiki instance value), userid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&userid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive a list with the pages of the user. Confirm that the pages have the caneditpage attribute set to true . Perform the request again but using the teacher's userid. Confirm that you receive an error of type cannotviewpage . Test collaborative wiki with visible groups Now create a new collaborative wiki but using visible groups. Create at least 1 page per group. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the groupid the student belongs to . You need to replace the wstoken, wikiid (the wiki instance value), groupid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=6&groupid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true . Now perform another request but with the other group (the one the user doesn't belong to). Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to false . Test collaborative wiki with separate groups Now create a new collaborative wiki but using separate groups. Create at least 1 page per group. Next, you can do a CURL REST call simulating a WS client with the student user. Please use the groupid the student belongs to . curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=4&groupid=4&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true . Now perform another request but with the other group (the one the user doesn't belong to). Confirm that you receive an error of type cannotviewpage . Now create a token for the teacher user. Click on Site administration ► Plugins ► Web services ► Manage tokens Now perform the request again using the teacher WS token and a group ID the teacher doesn't belong to. Confirm that you receive a list with the pages of that group. Confirm that the pages have the caneditpage attribute set to true . Test sort params Now we have to test that the sort params work, we'll use the first wiki (collaborative without groups). If it only has one page, add at least one more page to it. Please make the title of one of the new pages start with "AAA" (so it's the first in alphabetical order). Do a CURL REST call using the student's token. We won't specify sort params for now. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that the pages are ordered alphabetically by title and that the firstpage has the value firstpage set to true , while the other pages have it set to false. Now do a CURL REST call simulating a WS client but using sort params. We will sort it by id. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179&options%5Bsortby%5D=id' --compressed Confirm that the pages are ordered by ID and that the firstpage has the value firstpage set to true , while the other pages have it set to false. Finally, we'll check the includecontent option. Do a CURL REST call simulating a WS client but using includecontent param set to 0 (false). curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_wiki_get_subwiki_pages&wikiid=1&wstoken=5b6154a56566a194f60f7f395f235179&options%5Bincludecontent%5D=0' --compressed Check that the returned pages don't include content.

      This function will return the list of pages of a certain subwiki.

            dpalou Dani Palou
            dpalou Dani Palou
            Adrian Greeve Adrian Greeve
            Andrew Lyons Andrew Lyons
            Ryan Wyllie Ryan Wyllie
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.