Add acceptance tests for antivirus (#6405)
test on ci test on ci run on detached mode add wait for clam fix syntax fix syntax try without wait add clamservice to steps use different wait for command put sleep test wait for clamav service Clean up tests and enable other tests in the ci address reviews add documentation add docs for docker address reviews refactor docs remove user premission as it's by default root capitalize the letters
This commit is contained in:
@@ -13,6 +13,7 @@ use Behat\Gherkin\Node\PyStringNode;
|
||||
use TestHelpers\EmailHelper;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\GraphHelper;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
@@ -80,7 +81,7 @@ class NotificationContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^user "([^"]*)" lists all notifications$/
|
||||
* @When /^user "([^"]*)" lists all notifications$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
@@ -127,20 +128,7 @@ class NotificationContext implements Context {
|
||||
string $subject,
|
||||
PyStringNode $schemaString
|
||||
): void {
|
||||
if (isset($this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data)) {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
|
||||
foreach ($responseBody as $value) {
|
||||
if (isset($value->subject) && $value->subject === $subject) {
|
||||
$responseBody = $value;
|
||||
// set notificationId
|
||||
$this->notificationIds[] = $value->notification_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
}
|
||||
|
||||
$responseBody = $this->filterResponseAccordingToNotificationSubject($subject);
|
||||
// substitute the value here
|
||||
$schemaString = $schemaString->getRaw();
|
||||
$schemaString = $this->featureContext->substituteInLineCodes(
|
||||
@@ -157,6 +145,50 @@ class NotificationContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $subject
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function filterResponseAccordingToNotificationSubject(string $subject): object {
|
||||
$responseBody = null;
|
||||
if (isset($this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data)) {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->ocs->data;
|
||||
foreach ($responseBody as $value) {
|
||||
if (isset($value->subject) && $value->subject === $subject) {
|
||||
$responseBody = $value;
|
||||
// set notificationId
|
||||
$this->notificationIds[] = $value->notification_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
|
||||
}
|
||||
return $responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should get a notification with subject :subject and message:
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $subject
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userShouldGetANotificationWithMessage(string $user, string $subject, TableNode $table):void {
|
||||
$this->userListAllNotifications($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200);
|
||||
$actualMessage = $this->filterResponseAccordingToNotificationSubject($subject)->message;
|
||||
$expectedMessage = $table->getColumnsHash()[0]['message'];
|
||||
Assert::assertSame(
|
||||
$expectedMessage,
|
||||
$actualMessage,
|
||||
__METHOD__ . "expected message to be '$expectedMessage' but found'$actualMessage'"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then user :user should have received the following email from user :sender about the share of project space :spaceName
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user