1+ ##############################################
2+ # TEST 0: Valid request - S1 queries element from C1 (enrolled)
3+ # POSITIVE TEST: S1 is enrolled in C1, should successfully get element IDs
4+ # Expected: HTTP 200 with valid element data, no exception
5+ ##############################################
6+ POST {{host}}/webservice/rest/server.php
7+ Content-Type : application/x-www-form-urlencoded
8+ [FormParams]
9+ wsfunction : local_adler_get_element_ids_by_uuids
10+ moodlewsrestformat : json
11+ wstoken : {{ moodleS1Token }}
12+ elements[0][course_id]: {{course_c1_id}}
13+ elements[0][element_type]: cm
14+ elements[0][uuid]: {{c1_cm_uuid}}
15+
16+ HTTP 200
17+ [Asserts]
18+ # Should NOT have an exception - this is a valid request
19+ jsonpath "$.exception" not exists
20+ # Should return element data
21+ jsonpath "$.data" count > 0
22+
123##############################################
224# TEST 1: S2 queries element from C1 (not enrolled)
325# Should be BLOCKED - s2 is not enrolled in c1
@@ -8,7 +30,9 @@ Content-Type: application/x-www-form-urlencoded
830wsfunction : local_adler_get_element_ids_by_uuids
931moodlewsrestformat : json
1032wstoken : {{ moodleS2Token }}
11- elements : [{"course_id":"{{ course_c1_id }} ","element_type":"cm","uuid":"{{ c1_cm_uuid }} "}]
33+ elements[0][course_id]: {{course_c1_id}}
34+ elements[0][element_type]: cm
35+ elements[0][uuid]: {{c1_cm_uuid}}
1236
1337HTTP 200
1438[Asserts]
@@ -26,7 +50,9 @@ Content-Type: application/x-www-form-urlencoded
2650wsfunction : local_adler_get_element_ids_by_uuids
2751moodlewsrestformat : json
2852wstoken : {{ moodleM2Token }}
29- elements : [{"course_id":"{{ course_c1_id }} ","element_type":"cm","uuid":"{{ c1_cm_uuid }} "}]
53+ elements[0][course_id]: {{course_c1_id}}
54+ elements[0][element_type]: cm
55+ elements[0][uuid]: {{c1_cm_uuid}}
3056
3157HTTP 200
3258[Asserts]
@@ -42,7 +68,9 @@ Content-Type: application/x-www-form-urlencoded
4268wsfunction : local_adler_get_element_ids_by_uuids
4369moodlewsrestformat : json
4470wstoken : {{ moodleS2Token }}
45- elements : [{"course_id":"999999","element_type":"cm","uuid":"{{ c1_cm_uuid }} "}]
71+ elements[0][course_id]: 999999
72+ elements[0][element_type]: cm
73+ elements[0][uuid]: {{c1_cm_uuid}}
4674
4775HTTP 200
4876[Asserts]
@@ -58,7 +86,9 @@ Content-Type: application/x-www-form-urlencoded
5886wsfunction : local_adler_get_element_ids_by_uuids
5987moodlewsrestformat : json
6088wstoken : {{ moodleS2Token }}
61- elements : [{"course_id":"1' OR '1'='1","element_type":"cm","uuid":"{{ c1_cm_uuid }} "}]
89+ elements[0][course_id]: 1' OR '1'='1
90+ elements[0][element_type]: cm
91+ elements[0][uuid]: {{c1_cm_uuid}}
6292
6393HTTP 200
6494[Asserts]
@@ -74,7 +104,9 @@ Content-Type: application/x-www-form-urlencoded
74104wsfunction : local_adler_get_element_ids_by_uuids
75105moodlewsrestformat : json
76106wstoken : {{ moodleS2Token }}
77- elements : [{"course_id":"{{ course_c1_id }} ","element_type":"cm","uuid":"abc' OR '1'='1"}]
107+ elements[0][course_id]: {{course_c1_id}}
108+ elements[0][element_type]: cm
109+ elements[0][uuid]: abc' OR '1'='1
78110
79111HTTP 200
80112[Asserts]
@@ -90,7 +122,9 @@ Content-Type: application/x-www-form-urlencoded
90122wsfunction : local_adler_get_element_ids_by_uuids
91123moodlewsrestformat : json
92124wstoken : {{ moodleS1Token }}
93- elements : [{"course_id":"{{ course_c1_id }} ","element_type":"cm","uuid":""}]
125+ elements[0][course_id]: {{course_c1_id}}
126+ elements[0][element_type]: cm
127+ elements[0][uuid]:
94128
95129HTTP 200
96130[Asserts]
@@ -106,7 +140,9 @@ Content-Type: application/x-www-form-urlencoded
106140wsfunction : local_adler_get_element_ids_by_uuids
107141moodlewsrestformat : json
108142wstoken : {{ moodleS1Token }}
109- elements : [{"course_id":"{{ course_c1_id }} ","element_type":"cm","uuid":"*"}]
143+ elements[0][course_id]: {{course_c1_id}}
144+ elements[0][element_type]: cm
145+ elements[0][uuid]: *
110146
111147HTTP 200
112148[Asserts]
0 commit comments