diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-11-29 13:30:25 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-01-08 09:21:22 +0100 |
commit | 1068b860ff8cfabedee78f86d9655e8c0c206170 (patch) | |
tree | 013e7cf8bc2ee2bb4b975cb7a9135f21b185ec76 /apps | |
parent | 5cae135b94d495449948978d5e2207335843697b (diff) | |
download | nextcloud-server-1068b860ff8cfabedee78f86d9655e8c0c206170.tar.gz nextcloud-server-1068b860ff8cfabedee78f86d9655e8c0c206170.zip |
adjust tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/tests/Group_LDAPTest.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 45 |
2 files changed, 11 insertions, 36 deletions
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index f80b043016d..7ea4cb463d9 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -1054,7 +1054,7 @@ class Group_LDAPTest extends TestCase { $ldap = new GroupLDAP($access, $pluginManager); $resultingMembers = $this->invokePrivate($ldap, '_groupMembers', [$groupDN]); - $this->assertEquals($expectedMembers, $resultingMembers, '', 0.0, 10, true); + $this->assertEqualsCanonicalizing($expectedMembers, $resultingMembers); } public function displayNameProvider() { diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 3717ecd8f38..3b473cc8de4 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -499,18 +499,7 @@ class User_LDAPTest extends TestCase { $this->prepareMockForUserExists(); $user = $this->createMock(User::class); - $user->expects($this->any()) - ->method('getDN') - ->willReturn('dnOfRoland,dc=test'); - $this->access->expects($this->any()) - ->method('readAttribute') - ->will($this->returnCallback(function($dn) { - if($dn === 'dnOfRoland,dc=test') { - return array(); - } - return false; - })); $this->userManager->expects($this->atLeastOnce()) ->method('get') ->willReturn($user); @@ -535,31 +524,17 @@ class User_LDAPTest extends TestCase { ->willReturn('45673458748'); $this->access->expects($this->any()) - ->method('readAttribute') - ->will($this->returnCallback(function($dn) { - if($dn === 'dnOfRoland,dc=test') { - return array(); - } - return false; - })); - $this->access->expects($this->any()) ->method('getUserMapper') ->willReturn($mapper); - $this->access->expects($this->once()) - ->method('getUserDnByUuid') - ->willThrowException(new \Exception()); $user = $this->createMock(User::class); - $user->expects($this->any()) - ->method('getDN') - ->willReturn('dnOfFormerUser,dc=test'); $this->userManager->expects($this->atLeastOnce()) ->method('get') ->willReturn($user); - //test for deleted user - $this->assertFalse($backend->userExists('formerUser')); + //test for deleted user – always returns true as long as we have the user in DB + $this->assertTrue($backend->userExists('formerUser')); } public function testUserExistsForNeverExisting() { @@ -646,8 +621,8 @@ class User_LDAPTest extends TestCase { ->method('get') ->willReturn($user); - //test for deleted user - $this->assertFalse(\OC::$server->getUserManager()->userExists('formerUser')); + //test for deleted user – always returns true as long as we have the user in DB + $this->assertTrue(\OC::$server->getUserManager()->userExists('formerUser')); } public function testUserExistsPublicAPIForNeverExisting() { @@ -777,7 +752,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals($dataDir.'/susannah/', $result); } - + public function testGetHomeNoPath() { $this->expectException(\Exception::class); @@ -1101,7 +1076,7 @@ class User_LDAPTest extends TestCase { ->willReturn(42); $this->assertEquals($this->backend->countUsers(),42); - } + } public function testLoginName2UserNameSuccess() { $loginName = 'Alice'; @@ -1269,7 +1244,7 @@ class User_LDAPTest extends TestCase { })); } - + public function testSetPasswordInvalid() { $this->expectException(\OC\HintException::class); $this->expectExceptionMessage('Password fails quality checking policy'); @@ -1283,7 +1258,7 @@ class User_LDAPTest extends TestCase { $this->assertTrue(\OC_User::setPassword('roland', 'dt')); } - + public function testSetPasswordValid() { $this->prepareAccessForSetPassword($this->access); @@ -1313,7 +1288,7 @@ class User_LDAPTest extends TestCase { $this->assertFalse(\OC_User::setPassword('roland', 'dt12234$')); } - + public function testSetPasswordWithInvalidUser() { $this->expectException(\Exception::class); $this->expectExceptionMessage('LDAP setPassword: Could not get user object for uid NotExistingUser. Maybe the LDAP entry has no set display name attribute?'); @@ -1414,7 +1389,7 @@ class User_LDAPTest extends TestCase { $this->assertEquals($newDisplayName, $this->backend->setDisplayName('uid', $newDisplayName)); } - + public function testSetDisplayNameErrorWithPlugin() { $this->expectException(\OC\HintException::class); |