diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-10-28 15:11:41 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-01-08 09:21:21 +0100 |
commit | 411a47cadb078987f1354dfcae0852154df42a06 (patch) | |
tree | c35a78fe4f300eacab7834c092a891deccc6f46f /apps/user_ldap/tests/User_LDAPTest.php | |
parent | 69ae7abe72fd032adbec1c7dc01fca64aea2fbe8 (diff) | |
download | nextcloud-server-411a47cadb078987f1354dfcae0852154df42a06.tar.gz nextcloud-server-411a47cadb078987f1354dfcae0852154df42a06.zip |
relax strict getHome behaviour for LDAP users in a shadow state
* simplifies deletion process
* less strange behaviour when looking up home storage (as long as it is local)
* thus could enable transfer ownerships after user went invisible on ldap
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests/User_LDAPTest.php')
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 7982ef0f42d..3717ecd8f38 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -314,22 +314,12 @@ class User_LDAPTest extends TestCase { $offlineUser->expects($this->once()) ->method('getHomePath') ->willReturn($home); - $offlineUser->expects($this->once()) - ->method('getOCName') - ->willReturn($uid); $this->userManager->expects($this->atLeastOnce()) ->method('get') ->willReturn($offlineUser); $backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager); - /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */ - $user = $this->createMock(IUser::class); - $user->expects($this->once()) - ->method('getUID') - ->willReturn($uid); - - $backend->preDeleteUser($user); $result = $backend->deleteUser($uid); $this->assertTrue($result); /** @noinspection PhpUnhandledExceptionInspection */ @@ -836,10 +826,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse($result); } - public function testGetHomeDeletedUser() { - $this->expectException(\OC\User\NoUserException::class); - $uid = 'newyorker'; $backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager); @@ -869,14 +856,16 @@ class User_LDAPTest extends TestCase { ->will($this->returnValue(true)); $offlineUser = $this->createMock(OfflineUser::class); - $offlineUser->expects($this->never()) - ->method('getHomePath'); + $offlineUser->expects($this->atLeastOnce()) + ->method('getHomePath') + ->willReturn(''); $this->userManager->expects($this->atLeastOnce()) ->method('get') ->willReturn($offlineUser); - $backend->getHome($uid); + $result = $backend->getHome($uid); + $this->assertFalse($result); } public function testGetHomeWithPlugin() { |