mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-08-07 05:14:57 -04:00
Add local API acceptance tests
This commit is contained in:
1 parent
67861acd73
commit
b36390e017
13 files changed
+387
-3
No files matched your search
@@ -0,0 +1,27 @@
|
||||
@api
|
||||
Feature: auth
|
||||
|
||||
@issue-ocis-reva-30 @issue-ocis-reva-65
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: send DELETE requests to OCS endpoints as admin with wrong password
|
||||
When the administrator requests these endpoints with "DELETE" using password "invalid" about user "Alice"
|
||||
| endpoint |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/123 |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares/123 |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares/pending/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares/pending/123 |
|
||||
| /ocs/v1.php/cloud/apps/testing |
|
||||
| /ocs/v2.php/cloud/apps/testing |
|
||||
| /ocs/v1.php/cloud/groups/group1 |
|
||||
| /ocs/v2.php/cloud/groups/group1 |
|
||||
| /ocs/v1.php/cloud/users/%username% |
|
||||
| /ocs/v2.php/cloud/users/%username% |
|
||||
| /ocs/v1.php/cloud/users/%username%/groups |
|
||||
| /ocs/v2.php/cloud/users/%username%/groups |
|
||||
| /ocs/v1.php/cloud/users/%username%/subadmins |
|
||||
| /ocs/v2.php/cloud/users/%username%/subadmins |
|
||||
Then the HTTP status code of responses on all endpoints should be "401"
|
||||
And the OCS status code of responses on all endpoints should be "notset"
|
||||
@@ -0,0 +1,112 @@
|
||||
@api
|
||||
Feature: auth
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and skeleton files
|
||||
|
||||
@issue-ocis-reva-29
|
||||
@issue-ocis-reva-30
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: using OCS anonymously
|
||||
When a user requests these endpoints with "GET" and no authentication
|
||||
| endpoint |
|
||||
| /ocs/v1.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v2.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v1.php/cloud/apps |
|
||||
| /ocs/v2.php/cloud/apps |
|
||||
| /ocs/v1.php/cloud/groups |
|
||||
| /ocs/v2.php/cloud/groups |
|
||||
| /ocs/v1.php/cloud/users |
|
||||
| /ocs/v2.php/cloud/users |
|
||||
| /ocs/v1.php/config |
|
||||
| /ocs/v2.php/config |
|
||||
| /ocs/v1.php/privatedata/getattribute |
|
||||
| /ocs/v2.php/privatedata/getattribute |
|
||||
Then the HTTP status code of responses on all endpoints should be "401"
|
||||
And the OCS status code of responses on all endpoints should be "notset"
|
||||
|
||||
@issue-ocis-reva-11
|
||||
@issue-ocis-reva-30
|
||||
@issue-ocis-reva-31
|
||||
@issue-ocis-reva-32
|
||||
@issue-ocis-reva-33
|
||||
@issue-ocis-reva-34
|
||||
@issue-ocis-reva-35
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: using OCS with non-admin basic auth
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v1.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
| /ocs/v1.php/privatedata/getattribute |
|
||||
| /ocs/v1.php/cloud/groups |
|
||||
| /ocs/v1.php/cloud/apps |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
And the OCS status code of responses on all endpoints should be "998"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v1.php/config |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
And the OCS status code of responses on all endpoints should be "100"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v2.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
# | /ocs/v1.php/apps/files_sharing/api/v1/shares | 100 | 200 |
|
||||
# | /ocs/v2.php/apps/files_sharing/api/v1/shares | 100 | 200 |
|
||||
|
||||
| /ocs/v2.php/cloud/apps |
|
||||
| /ocs/v2.php/cloud/groups |
|
||||
| /ocs/v2.php/privatedata/getattribute |
|
||||
Then the HTTP status code of responses on all endpoints should be "404"
|
||||
And the OCS status code of responses on all endpoints should be "998"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v1.php/cloud/users |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
And the OCS status code of responses on all endpoints should be "403"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v2.php/cloud/users |
|
||||
Then the HTTP status code of responses on all endpoints should be "403"
|
||||
And the OCS status code of responses on all endpoints should be "403"
|
||||
When the user "Alice" requests these endpoints with "GET" with basic auth
|
||||
| endpoint |
|
||||
| /ocs/v2.php/config |
|
||||
Then the HTTP status code of responses on all endpoints should be "200"
|
||||
And the OCS status code of responses on all endpoints should be "200"
|
||||
|
||||
@issue-ocis-reva-29
|
||||
@issue-ocis-reva-30
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: using OCS as normal user with wrong password
|
||||
When user "Alice" requests these endpoints with "GET" using password "invalid"
|
||||
| endpoint |
|
||||
| /ocs/v1.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v2.php/apps/files_external/api/v1/mounts |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v1.php/cloud/apps |
|
||||
| /ocs/v2.php/cloud/apps |
|
||||
| /ocs/v1.php/cloud/groups |
|
||||
| /ocs/v2.php/cloud/groups |
|
||||
| /ocs/v1.php/cloud/users |
|
||||
| /ocs/v2.php/cloud/users |
|
||||
| /ocs/v1.php/config |
|
||||
| /ocs/v2.php/config |
|
||||
| /ocs/v1.php/privatedata/getattribute |
|
||||
| /ocs/v2.php/privatedata/getattribute |
|
||||
Then the HTTP status code of responses on all endpoints should be "401"
|
||||
And the OCS status code of responses on all endpoints should be "notset"
|
||||
@@ -0,0 +1,35 @@
|
||||
@api
|
||||
Feature: auth
|
||||
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes and skeleton files
|
||||
|
||||
@issue-ocis-reva-30
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: send POST requests to OCS endpoints as normal user with wrong password
|
||||
When user "Alice" requests these endpoints with "POST" including body "doesnotmatter" using password "invalid" about user "Alice"
|
||||
| endpoint |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/123 |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares/pending/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares/pending/123 |
|
||||
| /ocs/v1.php/cloud/apps/testing |
|
||||
| /ocs/v2.php/cloud/apps/testing |
|
||||
| /ocs/v1.php/cloud/groups |
|
||||
| /ocs/v2.php/cloud/groups |
|
||||
| /ocs/v1.php/cloud/users |
|
||||
| /ocs/v2.php/cloud/users |
|
||||
| /ocs/v1.php/cloud/users/%username%/groups |
|
||||
| /ocs/v2.php/cloud/users/%username%/groups |
|
||||
| /ocs/v1.php/cloud/users/%username%/subadmins |
|
||||
| /ocs/v2.php/cloud/users/%username%/subadmins |
|
||||
| /ocs/v1.php/person/check |
|
||||
| /ocs/v2.php/person/check |
|
||||
| /ocs/v1.php/privatedata/deleteattribute/testing/test |
|
||||
| /ocs/v2.php/privatedata/deleteattribute/testing/test |
|
||||
| /ocs/v1.php/privatedata/setattribute/testing/test |
|
||||
| /ocs/v2.php/privatedata/setattribute/testing/test |
|
||||
Then the HTTP status code of responses on all endpoints should be "401"
|
||||
And the OCS status code of responses on all endpoints should be "notset"
|
||||
@@ -0,0 +1,18 @@
|
||||
@api
|
||||
Feature: auth
|
||||
|
||||
@issue-ocis-reva-30
|
||||
# after fixing all issues delete this Scenario and use the one from oC10 core
|
||||
Scenario: send PUT request to OCS endpoints as admin with wrong password
|
||||
When the administrator requests these endpoints with "PUT" with body "doesnotmatter" using password "invalid" about user "Alice"
|
||||
| endpoint |
|
||||
| /ocs/v1.php/cloud/users/%username% |
|
||||
| /ocs/v2.php/cloud/users/%username% |
|
||||
| /ocs/v1.php/cloud/users/%username%/disable |
|
||||
| /ocs/v2.php/cloud/users/%username%/disable |
|
||||
| /ocs/v1.php/cloud/users/%username%/enable |
|
||||
| /ocs/v2.php/cloud/users/%username%/enable |
|
||||
| /ocs/v1.php/apps/files_sharing/api/v1/shares/123 |
|
||||
| /ocs/v2.php/apps/files_sharing/api/v1/shares/123 |
|
||||
Then the HTTP status code of responses on all endpoints should be "401"
|
||||
And the OCS status code of responses on all endpoints should be "notset"
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use TestHelpers\AppConfigHelper;
|
||||
use TestHelpers\SetupHelper;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
/**
|
||||
* Context for Reva specific steps
|
||||
*/
|
||||
class RevaContext implements Context {
|
||||
|
||||
/**
|
||||
* @var FeatureContext
|
||||
*/
|
||||
private $featureContext;
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*
|
||||
* @param BeforeScenarioScope $scope
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setUpScenario(BeforeScenarioScope $scope) {
|
||||
// Get the environment
|
||||
$environment = $scope->getEnvironment();
|
||||
// Get all the contexts you need in this context
|
||||
$this->featureContext = $environment->getContext('FeatureContext');
|
||||
SetupHelper::init(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$this->featureContext->getAdminPassword(),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getOcPath()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$pathToCore = \getenv('PATH_TO_CORE');
|
||||
if ($pathToCore === false) {
|
||||
$pathToCore = "../core";
|
||||
}
|
||||
|
||||
require_once $pathToCore . '/tests/acceptance/features/bootstrap/bootstrap.php';
|
||||
|
||||
$classLoader = new \Composer\Autoload\ClassLoader();
|
||||
$classLoader->addPsr4(
|
||||
"", $pathToCore . "/tests/acceptance/features/bootstrap", true
|
||||
);
|
||||
|
||||
$classLoader->register();
|
||||
Reference in new issue
Block a user