-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Moodle plugin CI errors in local_o365
- Loading branch information
1 parent
4265edf
commit b0660bd
Showing
1 changed file
with
9 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
use advanced_testcase; | ||
use local_o365\feature\usersync\main; | ||
use local_o365\oauth2\token; | ||
use local_o365\rest\unified; | ||
use local_o365\tests\mockhttpclient; | ||
|
||
/** | ||
|
@@ -107,7 +108,7 @@ protected function get_entra_id_userinfo($i = 0) { | |
'mail' => 'testuser' . $i . '@example.onmicrosoft.com', | ||
'surname' => 'User' . $i, | ||
'preferredLanguage' => ($i == 3) ? 'sa-IN' : 'en-US', | ||
'useridentifier' => 'testuser' . $i . '@example.onmicrosoft.com', | ||
'userPrincipalName' => 'testuser' . $i . '@example.onmicrosoft.com', | ||
]; | ||
} | ||
|
||
|
@@ -132,7 +133,7 @@ public static function dataprovider_create_user_from_entra_id_data(): array { | |
'givenName' => 'Test', | ||
'mail' => '[email protected]', | ||
'surname' => 'User1', | ||
'useridentifier' => '[email protected]', | ||
'userPrincipalName' => '[email protected]', | ||
], | ||
[ | ||
'auth' => 'oidc', | ||
|
@@ -161,7 +162,7 @@ public static function dataprovider_create_user_from_entra_id_data(): array { | |
'givenName' => 'Test', | ||
'mail' => '[email protected]', | ||
'surname' => 'User2', | ||
'useridentifier' => '[email protected]', | ||
'userPrincipalName' => '[email protected]', | ||
], | ||
[ | ||
'auth' => 'oidc', | ||
|
@@ -189,7 +190,7 @@ public static function dataprovider_create_user_from_entra_id_data(): array { | |
'givenName' => 'Test', | ||
'mail' => '[email protected]', | ||
'surname' => 'User3', | ||
'useridentifier' => '[email protected]', | ||
'userPrincipalName' => '[email protected]', | ||
], | ||
[ | ||
'auth' => 'oidc', | ||
|
@@ -216,7 +217,7 @@ public static function dataprovider_create_user_from_entra_id_data(): array { | |
'givenName' => 'Test', | ||
'mail' => '[email protected]', | ||
'surname' => 'User4', | ||
'useridentifier' => '[email protected]', | ||
'userPrincipalName' => '[email protected]', | ||
], | ||
[ | ||
'auth' => 'oidc', | ||
|
@@ -291,7 +292,7 @@ public function test_sync_users_create(): void { | |
'username' => 'testuser' . $i . '@example.onmicrosoft.com', | ||
'userid' => $muser['id'], | ||
'scope' => 'test', | ||
'tokenresource' => \local_o365\rest\unified::get_tokenresource(), | ||
'tokenresource' => unified::get_tokenresource(), | ||
'token' => '000', | ||
'expiry' => '9999999999', | ||
'refreshtoken' => 'fsdfsdf' . $i, | ||
|
@@ -311,7 +312,7 @@ public function test_sync_users_create(): void { | |
$httpclient = new mockhttpclient(); | ||
$httpclient->set_response($response); | ||
|
||
$apiclient = new \local_o365\rest\unified($this->get_mock_token(), $httpclient); | ||
$apiclient = new unified($this->get_mock_token(), $httpclient); | ||
$usersync = new main($clientdata, $httpclient); | ||
$users = $apiclient->get_users(); | ||
$usersync->sync_users($users); | ||
|
@@ -321,6 +322,7 @@ public function test_sync_users_create(): void { | |
|
||
$createduser = ['auth' => 'oidc', 'username' => '[email protected]']; | ||
$this->assertTrue($DB->record_exists('user', $createduser)); | ||
|
||
$createduser = $DB->get_record('user', $createduser); | ||
$this->assertEquals('Test', $createduser->firstname); | ||
$this->assertEquals('User3', $createduser->lastname); | ||
|