diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-04-12 10:57:42 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-08-09 23:45:11 +0200 |
commit | eaf352b8d11251becbbd04690af80e04e3b1e35e (patch) | |
tree | 8d9f0771440b5762b7575750821b1bfaa09950c4 /build | |
parent | d1a8a909de471eab64bf5fac8d83a6c9fa812b33 (diff) | |
download | nextcloud-server-eaf352b8d11251becbbd04690af80e04e3b1e35e.tar.gz nextcloud-server-eaf352b8d11251becbbd04690af80e04e3b1e35e.zip |
integration test to ensure entries without displayname don't cause trouble
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/LDAPContext.php | 17 | ||||
-rw-r--r-- | build/integration/ldap_features/ldap-openldap.feature | 17 |
2 files changed, 22 insertions, 12 deletions
diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php index ce63bc3f698..a4a878b1ca8 100644 --- a/build/integration/features/bootstrap/LDAPContext.php +++ b/build/integration/features/bootstrap/LDAPContext.php @@ -141,17 +141,16 @@ class LDAPContext implements Context { } /** - * @Given /^the group result should$/ + * @Given /^the "([^"]*)" result should match$/ */ - public function theGroupResultShould(TableNode $expectations) { - $listReturnedGroups = simplexml_load_string($this->response->getBody())->data[0]->groups[0]->element; - $extractedGroupsArray = json_decode(json_encode($listReturnedGroups), 1); - - foreach($expectations->getRows() as $groupExpectation) { - if((int)$groupExpectation[1] === 1) { - PHPUnit_Framework_Assert::assertContains($groupExpectation[0], $extractedGroupsArray); + public function theGroupResultShouldMatch(string $type, TableNode $expectations) { + $listReturnedElements = simplexml_load_string($this->response->getBody())->data[0]->$type[0]->element; + $extractedIDsArray = json_decode(json_encode($listReturnedElements), 1); + foreach($expectations->getRows() as $expectation) { + if((int)$expectation[1] === 1) { + PHPUnit_Framework_Assert::assertContains($expectation[0], $extractedIDsArray); } else { - PHPUnit_Framework_Assert::assertNotContains($groupExpectation[0], $extractedGroupsArray); + PHPUnit_Framework_Assert::assertNotContains($expectation[0], $extractedIDsArray); } } } diff --git a/build/integration/ldap_features/ldap-openldap.feature b/build/integration/ldap_features/ldap-openldap.feature index 13e011bb0c8..d992f77c67c 100644 --- a/build/integration/ldap_features/ldap-openldap.feature +++ b/build/integration/ldap_features/ldap-openldap.feature @@ -17,6 +17,17 @@ Feature: LDAP | email | alice@nextcloud.ci | | displayname | Alice | + Scenario: Look for a expected LDAP users + Given having a valid LDAP configuration + And modify LDAP configuration + | ldapExpertUsernameAttr | uid | + And As an "admin" + And sending "GET" to "/cloud/users" + Then the OCS status code should be "200" + And the "users" result should match + | alice | 1 | + | ghost | 0 | + Scenario: Test group filter with one specific group Given having a valid LDAP configuration And modify LDAP configuration @@ -25,7 +36,7 @@ Feature: LDAP And As an "admin" And sending "GET" to "/cloud/groups" Then the OCS status code should be "200" - And the group result should + And the "groups" result should match | RedGroup | 1 | | GreenGroup | 0 | | BlueGroup | 0 | @@ -39,7 +50,7 @@ Feature: LDAP And As an "admin" And sending "GET" to "/cloud/groups" Then the OCS status code should be "200" - And the group result should + And the "groups" result should match | RedGroup | 1 | | GreenGroup | 1 | | BlueGroup | 0 | @@ -53,7 +64,7 @@ Feature: LDAP And As an "admin" And sending "GET" to "/cloud/groups" Then the OCS status code should be "200" - And the group result should + And the "groups" result should match | RedGroup | 1 | | GreenGroup | 1 | | BlueGroup | 1 | |