Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

External tests.

Copyright: 2018 Jun Pataleta
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1115 lines (44 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

external_test:: (42 methods):
  test_approve_data_request_not_logged_in()
  test_approve_data_request_not_dpo()
  test_approve_data_request_not_waiting_for_approval()
  test_approve_data_request()
  test_approve_data_request_non_existent()
  test_cancel_data_request_other_user()
  test_cancel_data_request_other_user_as_requester()
  test_cancel_data_request_requester_lost_permissions()
  test_cancel_data_request_other_user_as_child()
  test_cancel_data_request()
  test_contact_dpo()
  test_contact_dpo_with_nasty_input()
  test_deny_data_request_not_logged_in()
  test_deny_data_request_not_dpo()
  test_deny_data_request_not_waiting_for_approval()
  test_deny_data_request()
  test_deny_data_request_non_existent()
  test_get_data_request_not_logged_in()
  test_get_data_request_not_dpo()
  test_get_data_request()
  test_get_data_request_non_existent()
  test_set_context_defaults_no_capability()
  test_set_context_defaults()
  test_get_category_options_no_capability()
  get_options_provider()
  test_get_category_options()
  test_get_purpose_options_no_capability()
  test_get_purpose_options()
  get_activity_options_provider()
  test_get_activity_options()
  test_bulk_approve_data_requests()
  test_bulk_approve_data_requests_non_existent()
  test_bulk_approve_data_requests_no_permission()
  test_bulk_approve_data_requests_own_request()
  test_bulk_deny_data_requests()
  test_bulk_deny_data_requests_non_existent()
  test_bulk_deny_data_requests_no_permission()
  test_bulk_deny_data_requests_own_request()
  test_get_users_using_using_non_identity()
  test_get_users_using_identity_without_permission()
  test_get_users_using_field_not_in_identity()
  test_get_users()


Class: external_test  - X-Ref

External testcase.

test_approve_data_request_not_logged_in()   X-Ref
Test for external::approve_data_request() with the user not logged in.


test_approve_data_request_not_dpo()   X-Ref
Test for external::approve_data_request() with the user not having a DPO role.


test_approve_data_request_not_waiting_for_approval()   X-Ref
Test for external::approve_data_request() for request that's not ready for approval


test_approve_data_request()   X-Ref
Test for external::approve_data_request()


test_approve_data_request_non_existent()   X-Ref
Test for external::approve_data_request() for a non-existent request ID.


test_cancel_data_request_other_user()   X-Ref
Test for external::cancel_data_request() of another user.


test_cancel_data_request_other_user_as_requester()   X-Ref
Test cancellation of a request where you are the requester of another user's data.


test_cancel_data_request_requester_lost_permissions()   X-Ref
Test cancellation of a request where you are the requester of another user's data.


test_cancel_data_request_other_user_as_child()   X-Ref
Test cancellation of a request where you are the requester of another user's data.


test_cancel_data_request()   X-Ref
Test for external::cancel_data_request()


test_contact_dpo()   X-Ref
Test contact DPO.


test_contact_dpo_with_nasty_input()   X-Ref
Test contact DPO with message containing invalid input.


test_deny_data_request_not_logged_in()   X-Ref
Test for external::deny_data_request() with the user not logged in.


test_deny_data_request_not_dpo()   X-Ref
Test for external::deny_data_request() with the user not having a DPO role.


test_deny_data_request_not_waiting_for_approval()   X-Ref
Test for external::deny_data_request() for request that's not ready for approval


test_deny_data_request()   X-Ref
Test for external::deny_data_request()


test_deny_data_request_non_existent()   X-Ref
Test for external::deny_data_request() for a non-existent request ID.


test_get_data_request_not_logged_in()   X-Ref
Test for external::get_data_request() with the user not logged in.


test_get_data_request_not_dpo()   X-Ref
Test for external::get_data_request() with the user not having a DPO role.


test_get_data_request()   X-Ref
Test for external::get_data_request()


test_get_data_request_non_existent()   X-Ref
Test for external::get_data_request() for a non-existent request ID.


test_set_context_defaults_no_capability()   X-Ref
Test for \tool_dataprivacy\external::set_context_defaults()
when called by a user that doesn't have the manage registry capability.


test_set_context_defaults($modulelevel, $override)   X-Ref
Test for \tool_dataprivacy\external::set_context_defaults().

We're just checking the module context level here to test the WS function.
More testing is done in \tool_dataprivacy_api_testcase::test_set_context_defaults().

param: bool $modulelevel Whether defaults are to be applied on the module context level or for an activity only.
param: bool $override Whether to override instances.

test_get_category_options_no_capability()   X-Ref
Test for \tool_dataprivacy\external::get_category_options()
when called by a user that doesn't have the manage registry capability.


get_options_provider()   X-Ref
Data provider for \tool_dataprivacy_external_testcase::test_XX_options().


test_get_category_options($includeinherit, $includenotset)   X-Ref
Test for \tool_dataprivacy\external::get_category_options().

param: bool $includeinherit Whether "Inherit" would be included to the options.
param: bool $includenotset Whether "Not set" would be included to the options.

test_get_purpose_options_no_capability()   X-Ref
Test for \tool_dataprivacy\external::get_purpose_options()
when called by a user that doesn't have the manage registry capability.


test_get_purpose_options($includeinherit, $includenotset)   X-Ref
Test for \tool_dataprivacy\external::get_purpose_options().

param: bool $includeinherit Whether "Inherit" would be included to the options.
param: bool $includenotset Whether "Not set" would be included to the options.

get_activity_options_provider()   X-Ref
Data provider for \tool_dataprivacy_external_testcase::get_activity_options().


test_get_activity_options($inheritcategory, $inheritpurpose, $nodefaults)   X-Ref
Test for \tool_dataprivacy\external::get_activity_options().

param: bool $inheritcategory Whether the category would be set to "Inherit".
param: bool $inheritpurpose Whether the purpose would be set to "Inherit".
param: bool $nodefaults Whether to fetch only activities that don't have defaults.

test_bulk_approve_data_requests()   X-Ref
Test for external::bulk_approve_data_requests().


test_bulk_approve_data_requests_non_existent()   X-Ref
Test for external::bulk_approve_data_requests() for a non-existent request ID.


test_bulk_approve_data_requests_no_permission()   X-Ref
Test for external::bulk_deny_data_requests() for a user without permission to deny requests.


test_bulk_approve_data_requests_own_request()   X-Ref
Test for external::bulk_deny_data_requests() for a user without permission to deny requests.


test_bulk_deny_data_requests()   X-Ref
Test for external::bulk_deny_data_requests().


test_bulk_deny_data_requests_non_existent()   X-Ref
Test for external::bulk_deny_data_requests() for a non-existent request ID.


test_bulk_deny_data_requests_no_permission()   X-Ref
Test for external::bulk_deny_data_requests() for a user without permission to deny requests.


test_bulk_deny_data_requests_own_request()   X-Ref
Test for external::bulk_deny_data_requests() for a user cannot approve their own request.


test_get_users_using_using_non_identity()   X-Ref
Test for external::get_users(), case search using non-identity field without
facing any permission problem.


test_get_users_using_identity_without_permission()   X-Ref
Test for external::get_users(), case search using identity field but
don't have "moodle/site:viewuseridentity" permission.


test_get_users_using_field_not_in_identity()   X-Ref
Test for external::get_users(), case search using disabled identity field
even they have "moodle/site:viewuseridentity" permission.


test_get_users()   X-Ref
Test for external::get_users(), case search using enabled identity field
with "moodle/site:viewuseridentity" permission.