From 411a47cadb078987f1354dfcae0852154df42a06 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 28 Oct 2019 15:11:41 +0100 Subject: 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 --- apps/user_ldap/tests/User_LDAPTest.php | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'apps/user_ldap/tests/User_LDAPTest.php') 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() { -- cgit v1.2.3