Skip to content

Commit f055592

Browse files
authored
Merge pull request #37035 from owncloud/showAuthenticationAndStorageBackendsForMount
[Tests-Only] Add acceptance test to show available backends using the occ command
2 parents a1f36fd + f86b421 commit f055592

File tree

2 files changed

+255
-0
lines changed

2 files changed

+255
-0
lines changed

tests/acceptance/features/bootstrap/OccContext.php

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,41 @@ public function listLocalStorageMountOptions() {
432432
$this->invokingTheCommand('files_external:list --mount-options --output=json');
433433
}
434434

435+
/**
436+
* List available backends
437+
*
438+
* @return void
439+
* @throws Exception
440+
*/
441+
public function listAvailableBackends() {
442+
$this->invokingTheCommand('files_external:backends --output=json');
443+
}
444+
445+
/**
446+
* List available backends of type
447+
*
448+
* @param String $type
449+
*
450+
* @return void
451+
* @throws Exception
452+
*/
453+
public function listAvailableBackendsOfType($type) {
454+
$this->invokingTheCommand('files_external:backends ' . $type . ' --output=json');
455+
}
456+
457+
/**
458+
* List backend of type
459+
*
460+
* @param String $type
461+
* @param String $backend
462+
*
463+
* @return void
464+
* @throws Exception
465+
*/
466+
public function listBackendOfType($type, $backend) {
467+
$this->invokingTheCommand('files_external:backends ' . $type . ' ' . $backend . ' --output=json');
468+
}
469+
435470
/**
436471
* List created local storage mount with --show-password
437472
*
@@ -1273,6 +1308,41 @@ public function adminConfiguresLocalStorageMountUsingTheOccCommand($key, $value,
12731308
);
12741309
}
12751310

1311+
/**
1312+
* @When the administrator lists the available backends using the occ command
1313+
*
1314+
* @return void
1315+
* @throws Exception
1316+
*/
1317+
public function adminListsAvailableBackendsUsingTheOccCommand() {
1318+
$this->listAvailableBackends();
1319+
}
1320+
1321+
/**
1322+
* @When the administrator lists the available backends of type :type using the occ command
1323+
*
1324+
* @param String $type
1325+
*
1326+
* @return void
1327+
* @throws Exception
1328+
*/
1329+
public function adminListsAvailableBackendsOfTypeUsingTheOccCommand($type) {
1330+
$this->listAvailableBackendsOfType($type);
1331+
}
1332+
1333+
/**
1334+
* @When the adminstrator lists the :backend backend of type :backendType using the occ command
1335+
*
1336+
* @param String $backend
1337+
* @param String $backendType
1338+
*
1339+
* @return void
1340+
* @throws Exception
1341+
*/
1342+
public function adminListsBackendOfTypeUsingTheOccCommand($backend, $backendType) {
1343+
$this->listBackendOfType($backendType, $backend);
1344+
}
1345+
12761346
/**
12771347
* @When the administrator lists configurations with the existing key :key for the local storage mount :localStorage
12781348
*
@@ -1406,6 +1476,108 @@ public function theFollowingLocalStoragesShouldNotExist(TableNode $mountPoints)
14061476
);
14071477
}
14081478
}
1479+
1480+
/**
1481+
* @Then the following backend types should be listed:
1482+
*
1483+
* @param TableNode $table
1484+
*
1485+
* @return void
1486+
* @throws Exception
1487+
*/
1488+
public function theFollowingBackendTypesShouldBeListed($table) {
1489+
$expectedBackendTypes = $table->getColumnsHash();
1490+
foreach ($expectedBackendTypes as $expectedBackendTypeEntry) {
1491+
Assert::assertArrayHasKey(
1492+
'backend-type',
1493+
$expectedBackendTypeEntry,
1494+
__METHOD__
1495+
. " The provided expected backend type entry '"
1496+
. \implode(', ', $expectedBackendTypeEntry)
1497+
. "' do not have key 'backend-type'"
1498+
);
1499+
}
1500+
$commandOutput = \json_decode($this->featureContext->getStdOutOfOccCommand());
1501+
$keys = \array_keys((array) $commandOutput);
1502+
foreach ($expectedBackendTypes as $backendTypesEntry) {
1503+
Assert::assertContains(
1504+
$backendTypesEntry['backend-type'],
1505+
$keys,
1506+
__METHOD__
1507+
. " ${backendTypesEntry['backend-type']} is not contained in '"
1508+
. \implode(', ', $keys)
1509+
. "' but was expected to be."
1510+
);
1511+
}
1512+
}
1513+
1514+
/**
1515+
* @Then the following authentication/storage backends should be listed:
1516+
*
1517+
* @param TableNode $table
1518+
*
1519+
* @return void
1520+
* @throws Exception
1521+
*/
1522+
public function theFollowingBackendsShouldBeListed($table) {
1523+
$expectedBackends = $table->getColumnsHash();
1524+
foreach ($expectedBackends as $expectedBackendEntry) {
1525+
Assert::assertArrayHasKey(
1526+
'backends',
1527+
$expectedBackendEntry,
1528+
__METHOD__
1529+
. " The provided expected backend entry '"
1530+
. \implode(', ', $expectedBackendEntry)
1531+
. "' do not have key 'backends'"
1532+
);
1533+
}
1534+
$commandOutput = \json_decode($this->featureContext->getStdOutOfOccCommand());
1535+
$keys = \array_keys((array) $commandOutput);
1536+
foreach ($expectedBackends as $backendsEntry) {
1537+
Assert::assertContains(
1538+
$backendsEntry['backends'],
1539+
$keys,
1540+
__METHOD__
1541+
. " ${backendsEntry['backends']} is not contained in '"
1542+
. \implode(', ', $keys)
1543+
. "' but was expected to be."
1544+
);
1545+
}
1546+
}
1547+
1548+
/**
1549+
* @Then the following authentication/storage backend keys should be listed:
1550+
*
1551+
* @param TableNode $table
1552+
*
1553+
* @return void
1554+
* @throws Exception
1555+
*/
1556+
public function theFollowingBackendKeysOfTypeShouldBeListed($table) {
1557+
$expectedBackendKeys = $table->getColumnsHash();
1558+
foreach ($expectedBackendKeys as $expectedBackendKeyEntry) {
1559+
Assert::assertArrayHasKey(
1560+
'backend-keys',
1561+
$expectedBackendKeyEntry,
1562+
__METHOD__
1563+
. " The provided expected backend key entry '"
1564+
. \implode(', ', $expectedBackendKeyEntry)
1565+
. "' do not have key 'backend-keys'"
1566+
);
1567+
}
1568+
$commandOutput = \json_decode($this->featureContext->getStdOutOfOccCommand());
1569+
$keys = \array_keys((array) $commandOutput);
1570+
foreach ($expectedBackendKeys as $backendKeysEntry) {
1571+
Assert::assertContains(
1572+
$backendKeysEntry['backend-keys'],
1573+
$keys,
1574+
__METHOD__
1575+
. " ${backendKeysEntry['backend-keys']} is not contained in '"
1576+
. \implode(', ', $keys)
1577+
. "' but was expected to be."
1578+
);
1579+
}
1580+
}
14091581

14101582
/**
14111583
* @Then the following local storage should be listed:
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
@cli @skipOnLDAP @local_storage
2+
Feature: show available backends using occ command
3+
As an admin
4+
I want to list backends
5+
So that I can manage available backends for created local storage
6+
7+
Background:
8+
Given the administrator has created the local storage mount "local_storage2"
9+
And the administrator has uploaded file with content "file in local storage" to "/local_storage2/file-in-local-storage.txt"
10+
11+
Scenario: list available backends for created local storage
12+
When the administrator lists the available backends using the occ command
13+
Then the following backend types should be listed:
14+
| backend-type |
15+
| authentication |
16+
| storage |
17+
18+
Scenario: list available backends of type authentication for created local storage
19+
When the administrator lists the available backends of type "authentication" using the occ command
20+
Then the following authentication backends should be listed:
21+
| backends |
22+
| password::sessioncredentials |
23+
| null::null |
24+
| builtin::builtin |
25+
| password::password |
26+
| oauth1::oauth1 |
27+
| oauth2::oauth2 |
28+
| publickey::rsa |
29+
| openstack::openstack |
30+
| openstack::rackspace |
31+
32+
Scenario: list available backends of type storage for created local storage
33+
When the administrator lists the available backends of type "storage" using the occ command
34+
Then the following storage backends should be listed:
35+
| backends |
36+
| dav |
37+
| owncloud |
38+
| sftp |
39+
| googledrive |
40+
| \OC\Files\Storage\SFTP_Key |
41+
| smb |
42+
| \OC\Files\Storage\SMB_OC |
43+
| local |
44+
45+
Scenario Outline: list specific backend of type storage for created local storage
46+
When the adminstrator lists the "<backend>" backend of type "storage" using the occ command
47+
Then the following storage backend keys should be listed:
48+
| backend-keys |
49+
| name |
50+
| identifier |
51+
| configuration |
52+
| storage_class |
53+
| supported_authentication_backends |
54+
| authentication_configuration |
55+
Examples:
56+
| backend |
57+
| dav |
58+
| owncloud |
59+
| sftp |
60+
| googledrive |
61+
| \OC\Files\Storage\SFTP_Key |
62+
| smb |
63+
| \OC\Files\Storage\SMB_OC |
64+
| local |
65+
66+
Scenario Outline: list specific backend of type authentication for created local storage
67+
When the adminstrator lists the "<backend>" backend of type "authentication" using the occ command
68+
Then the following authentication backend keys should be listed:
69+
| backend-keys |
70+
| name |
71+
| identifier |
72+
| configuration |
73+
Examples:
74+
| backend |
75+
| password::sessioncredentials |
76+
| null::null |
77+
| builtin::builtin |
78+
| password::password |
79+
| oauth1::oauth1 |
80+
| oauth2::oauth2 |
81+
| publickey::rsa |
82+
| openstack::openstack |
83+
| openstack::rackspace |

0 commit comments

Comments
 (0)