From e01e894b985d3c8ee88da755abf7d5c139787705 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Wed, 2 Dec 2015 17:29:42 +0000 Subject: Added capabilities context and tests --- .../capabilities_features/capabilities.feature | 34 ++++++++++++++++ build/integration/config/behat.yml | 13 ++++++- .../features/bootstrap/CapabilitiesContext.php | 45 ++++++++++++++++++++++ build/integration/federation/federated.feature | 26 ------------- .../federation_features/federated.feature | 26 +++++++++++++ 5 files changed, 117 insertions(+), 27 deletions(-) create mode 100644 build/integration/capabilities_features/capabilities.feature create mode 100644 build/integration/features/bootstrap/CapabilitiesContext.php delete mode 100644 build/integration/federation/federated.feature create mode 100644 build/integration/federation_features/federated.feature (limited to 'build/integration') diff --git a/build/integration/capabilities_features/capabilities.feature b/build/integration/capabilities_features/capabilities.feature new file mode 100644 index 00000000000..4adb884e80a --- /dev/null +++ b/build/integration/capabilities_features/capabilities.feature @@ -0,0 +1,34 @@ +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 | password | 1 | + | files_sharing | public | expire_date | 1 | + | files_sharing | public | send_mail | 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..a1a14aa3bb3 --- /dev/null +++ b/build/integration/features/bootstrap/CapabilitiesContext.php @@ -0,0 +1,45 @@ +getHash(); + } + + $capabilitiesXML = $this->response->xml()->data->capabilities; + + foreach ($fd as $row) { + if ($row['value'] === ''){ + $answeredValue = (string)$capabilitiesXML->$row['capability']->$row['feature']->$row['value_or_subfeature']; + if ( !$answeredValue === $row['value_or_subfeature']){ + PHPUnit_Framework_Assert::fail("Answered value $answeredValue is different to expected " . $row['value_or_subfeature']); + } + } else{ + $answeredValue = (string)$capabilitiesXML->$row['capability']->$row['feature']->$row['value_or_subfeature']->$row['value']; + if ( !$answeredValue === $row['value']){ + PHPUnit_Framework_Assert::fail("Answered value $answeredValue is different to expected " . $row['value']); + } + } + } + } + +} diff --git a/build/integration/federation/federated.feature b/build/integration/federation/federated.feature deleted file mode 100644 index 5437d01dee2..00000000000 --- a/build/integration/federation/federated.feature +++ /dev/null @@ -1,26 +0,0 @@ -Feature: federated - Background: - Given using api version "1" - - Scenario: Federate share a file with another server - Given Using server "REMOTE" - And user "user1" exists - And Using server "LOCAL" - And user "user0" exists - When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" - Then the OCS status code should be "100" - And the HTTP status code should be "200" - - - - - - - - - - - - - - diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature new file mode 100644 index 00000000000..5437d01dee2 --- /dev/null +++ b/build/integration/federation_features/federated.feature @@ -0,0 +1,26 @@ +Feature: federated + Background: + Given using api version "1" + + Scenario: Federate share a file with another server + Given Using server "REMOTE" + And user "user1" exists + And Using server "LOCAL" + And user "user0" exists + When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + + + + + + + + + + + + + + -- cgit v1.2.3