[test-only] ApiTest. test for password policy (#7276)

* test for password policy

* test flaky

* renamed envs
This commit is contained in:
Viktor Scharf
2023-09-18 10:21:35 +02:00
committed by GitHub
parent 5aaa2a0ce0
commit eb537987ad
3 changed files with 210 additions and 12 deletions
@@ -21,6 +21,7 @@
*/
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Exception\GuzzleException;
use TestHelpers\OcisConfigHelper;
use PHPUnit\Framework\Assert;
@@ -74,6 +75,28 @@ class OcisConfigContext implements Context {
);
}
/**
* @Given the following configs have been set:
*
* @param TableNode $table
*
* @return void
* @throws GuzzleException
*/
public function theConfigHasBeenSetToValue(TableNode $table): void {
$envs = [];
foreach ($table->getHash() as $row) {
$envs[$row['config']] = $row['value'];
}
$response = OcisConfigHelper::reConfigureOcis($envs);
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to set config"
);
}
/**
* @AfterScenario @env-config
*
@@ -2023,7 +2023,7 @@ class SpacesContext implements Context {
$rows = $table->getRowsHash();
$rows["path"] = \array_key_exists("path", $rows) ? $rows["path"] : null;
$rows["shareType"] = \array_key_exists("shareType", $rows) ? $rows["shareType"] : null;
$rows["shareType"] = \array_key_exists("shareType", $rows) ? $rows["shareType"] : 3;
$rows["permissions"] = \array_key_exists("permissions", $rows) ? $rows["permissions"] : null;
$rows["password"] = \array_key_exists("password", $rows) ? $rows["password"] : null;
$rows["name"] = \array_key_exists("name", $rows) ? $rows["name"] : null;