diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-03 16:54:36 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-03 16:54:36 +0100 |
commit | 7d99289cedb7a779051e5d62c8ef4381eb65be2c (patch) | |
tree | 6e7868b408d05cdb7a4780eeb24bd378820efa91 /build | |
parent | 602b636d3e101274c9d9be1eb25808bb1eea017e (diff) | |
parent | c744b30b3bd610cb2b276bb274170fb6e0d03294 (diff) | |
download | nextcloud-server-7d99289cedb7a779051e5d62c8ef4381eb65be2c.tar.gz nextcloud-server-7d99289cedb7a779051e5d62c8ef4381eb65be2c.zip |
Merge pull request #20907 from owncloud/integration_tests_for_capabilities
Added capabilities context and tests
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/capabilities_features/capabilities.feature | 31 | ||||
-rw-r--r-- | build/integration/config/behat.yml | 13 | ||||
-rw-r--r-- | build/integration/features/bootstrap/CapabilitiesContext.php | 49 | ||||
-rw-r--r-- | build/integration/federation_features/federated.feature (renamed from build/integration/federation/federated.feature) | 0 |
4 files changed, 92 insertions, 1 deletions
diff --git a/build/integration/capabilities_features/capabilities.feature b/build/integration/capabilities_features/capabilities.feature new file mode 100644 index 00000000000..6c1e727e7b3 --- /dev/null +++ b/build/integration/capabilities_features/capabilities.feature @@ -0,0 +1,31 @@ +Feature: capabilities + Background: + Given using api version "1" + + Scenario: getting capabilities with admin user + Given As an "admin" + When sending "GET" to "/cloud/capabilities" + Then the HTTP status code should be "200" + And fields of capabilities match with + | capability | feature | value_or_subfeature | value | + | core | pollinterval | 60 | | + | core | webdav-root | remote.php/webdav | | + | files_sharing | api_enabled | 1 | | + | files_sharing | public | enabled | 1 | + | files_sharing | public | upload | 1 | + | files_sharing | resharing | 1 | | + | files_sharing | federation | outgoing | 1 | + | files_sharing | federation | incoming | 1 | + | files | bigfilechunking | 1 | | + | files | undelete | 1 | | + | files | versioning | 1 | | + + + + + + + + + + diff --git a/build/integration/config/behat.yml b/build/integration/config/behat.yml index 37ed2b117f3..42f5f88ac8a 100644 --- a/build/integration/config/behat.yml +++ b/build/integration/config/behat.yml @@ -14,7 +14,7 @@ default: regular_user_password: 123456 federation: paths: - - %paths.base%/../federation + - %paths.base%/../federation_features contexts: - FederationContext: baseUrl: http://localhost:8080/ocs/ @@ -22,6 +22,17 @@ default: - admin - admin regular_user_password: 123456 + capabilities: + paths: + - %paths.base%/../capabilities_features + contexts: + - CapabilitiesContext: + baseUrl: http://localhost:8080/ocs/ + admin: + - admin + - admin + regular_user_password: 123456 + extensions: diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php new file mode 100644 index 00000000000..4e200bdf421 --- /dev/null +++ b/build/integration/features/bootstrap/CapabilitiesContext.php @@ -0,0 +1,49 @@ +<?php + +use Behat\Behat\Context\Context; +use Behat\Behat\Context\SnippetAcceptingContext; +use GuzzleHttp\Client; +use GuzzleHttp\Message\ResponseInterface; + +require __DIR__ . '/../../vendor/autoload.php'; + +/** + * Capabilities context. + */ +class CapabilitiesContext implements Context, SnippetAcceptingContext { + + use BasicStructure; + use Provisioning; + use Sharing; + + /** + * @Then /^fields of capabilities match with$/ + * @param \Behat\Gherkin\Node\TableNode|null $formData + */ + public function checkCapabilitiesResponse($formData){ + if ($formData instanceof \Behat\Gherkin\Node\TableNode) { + $fd = $formData->getHash(); + } + + $capabilitiesXML = $this->response->xml()->data->capabilities; + + foreach ($fd as $row) { + if ($row['value'] === ''){ + $answeredValue = (string)$capabilitiesXML->$row['capability']->$row['feature']; + PHPUnit_Framework_Assert::assertEquals( + $answeredValue, + $row['value_or_subfeature'], + "Failed field " . $row['capability'] . " " . $row['feature'] + ); + } else{ + $answeredValue = (string)$capabilitiesXML->$row['capability']->$row['feature']->$row['value_or_subfeature']; + PHPUnit_Framework_Assert::assertEquals( + $answeredValue, + $row['value'], + "Failed field: " . $row['capability'] . " " . $row['feature'] . " " . $row['value_or_subfeature'] + ); + } + } + } + +} diff --git a/build/integration/federation/federated.feature b/build/integration/federation_features/federated.feature index 5437d01dee2..5437d01dee2 100644 --- a/build/integration/federation/federated.feature +++ b/build/integration/federation_features/federated.feature |