From 1f7b08bd19dd37bec73903679b3e0bfdaed71927 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 19 Jan 2017 15:19:20 +0100 Subject: LDAP OCS Api for show config Signed-off-by: Arthur Schiwon --- .../integration/features/bootstrap/LDAPContext.php | 19 +++++++++++++++++++ build/integration/ldap_features/ldap-ocs.feature | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'build') diff --git a/build/integration/features/bootstrap/LDAPContext.php b/build/integration/features/bootstrap/LDAPContext.php index 3a66641685a..5d1f75ceff4 100644 --- a/build/integration/features/bootstrap/LDAPContext.php +++ b/build/integration/features/bootstrap/LDAPContext.php @@ -66,4 +66,23 @@ class LDAPContext implements Context { new \Behat\Gherkin\Node\TableNode([['key', $key], ['value', $value]]) ); } + + /** + * @Given /^the response should contain a tag "([^"]*)" with value "([^"]*)"$/ + */ + public function theResponseShouldContainATagWithValue($tagName, $expectedValue) { + $data = $this->response->xml()->data[0]->$tagName; + PHPUnit_Framework_Assert::assertEquals($expectedValue, $data[0]); + } + + /** + * @When /^getting the LDAP configuration with showPassword "([^"]*)"$/ + */ + public function gettingTheLDAPConfigurationWithShowPassword($showPassword) { + $this->sendingToWith( + 'GET', + $this->apiUrl . '/' . $this->configID . '?showPassword=' . $showPassword, + null + ); + } } diff --git a/build/integration/ldap_features/ldap-ocs.feature b/build/integration/ldap_features/ldap-ocs.feature index d925df3256d..df643b8a01c 100644 --- a/build/integration/ldap_features/ldap-ocs.feature +++ b/build/integration/ldap_features/ldap-ocs.feature @@ -46,3 +46,25 @@ Feature: LDAP | value | ldaps://my.ldap.server | Then the OCS status code should be "404" And the HTTP status code should be "404" + + Scenario: create, modify and get a configuration + Given As an "admin" + And creating an LDAP configuration at "/apps/user_ldap/api/v1/config" + And setting "ldapHost" of the LDAP configuration to "ldaps://my.ldap.server" + And setting "ldapLoginFilter" of the LDAP configuration to "(&(|(objectclass=inetOrgPerson))(uid=%uid))" + And setting "ldapAgentPassword" of the LDAP configuration to "psst,secret" + When getting the LDAP configuration with showPassword "0" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + And the response should contain a tag "ldapHost" with value "ldaps://my.ldap.server" + And the response should contain a tag "ldapLoginFilter" with value "(&(|(objectclass=inetOrgPerson))(uid=%uid))" + And the response should contain a tag "ldapAgentPassword" with value "***" + + Scenario: receiving password in plain text + Given As an "admin" + And creating an LDAP configuration at "/apps/user_ldap/api/v1/config" + And setting "ldapAgentPassword" of the LDAP configuration to "psst,secret" + When getting the LDAP configuration with showPassword "1" + Then the OCS status code should be "200" + And the HTTP status code should be "200" + And the response should contain a tag "ldapAgentPassword" with value "psst,secret" -- cgit v1.2.3