diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php index 5d7bb34a90..b1ccd59ab7 100644 --- a/build/integration/features/bootstrap/LDAPContext.php +++ b/build/integration/features/bootstrap/LDAPContext.php @@ -104,4 +104,24 @@ class LDAPContext implements Context { $this->settingTheLDAPConfigurationTo($data); $this->asAn(''); } + + /** + * @Given /^looking up details for the first result matches expectations$/ + * @param TableNode $expectations + */ + public function lookingUpDetailsForTheFirstResult(TableNode $expectations) { + $userResultElements = simplexml_load_string($this->response->getBody())->data[0]->users[0]->element; + $userResults = json_decode(json_encode($userResultElements), 1); + $userId = array_shift($userResults); + + $this->sendingTo('GET', '/cloud/users/' . $userId); + + foreach($expectations->getRowsHash() as $k => $v) { + $value = (string)simplexml_load_string($this->response->getBody())->data[0]->$k; + PHPUnit_Framework_Assert::assertEquals($v, $value); + } + + $backend = (string)simplexml_load_string($this->response->getBody())->data[0]->backend; + PHPUnit_Framework_Assert::assertEquals('LDAP', $backend); + } } diff --git a/build/integration/ldap_features/ldap-openldap.feature b/build/integration/ldap_features/ldap-openldap.feature index e52ab600ae..c63fdf1f9c 100644 --- a/build/integration/ldap_features/ldap-openldap.feature +++ b/build/integration/ldap_features/ldap-openldap.feature @@ -5,6 +5,13 @@ Feature: LDAP Scenario: Test valid configuration by logging in Given having a valid LDAP configuration When Logging in using web as "alice" - #When As an "alice" - And sending "GET" to "/cloud/user" Then the HTTP status code should be "200" + + Scenario: Look for a known LDAP user + Given having a valid LDAP configuration + And As an "admin" + And sending "GET" to "/cloud/users?search=alice" + Then the OCS status code should be "200" + And looking up details for the first result matches expectations + | email | alice@nextcloud.ci | + | displayname | Alice |