mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
feat: Add context and test steps for activity in sharing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
a57f694e8d
commit
140aba1f16
4 changed files with 45 additions and 4 deletions
30
build/integration/features/bootstrap/Activity.php
Normal file
30
build/integration/features/bootstrap/Activity.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use PHPUnit\Framework\Assert;
|
||||
|
||||
trait Activity {
|
||||
use BasicStructure;
|
||||
|
||||
/**
|
||||
* @Then last activity should be
|
||||
* @param TableNode $activity
|
||||
*/
|
||||
public function lastActivityIs(TableNode $activity): void {
|
||||
$this->sendRequestForJSON('GET', '/apps/activity/api/v2/activity');
|
||||
$this->theHTTPStatusCodeShouldBe('200');
|
||||
$data = json_decode($this->response->getBody()->getContents(), true);
|
||||
$activities = $data['ocs']['data'];
|
||||
$lastActivity = array_pop($activities);
|
||||
foreach ($activity->getRowsHash() as $key => $value) {
|
||||
Assert::assertEquals($value, $lastActivity[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,8 +192,8 @@ trait BasicStructure {
|
|||
$options = [];
|
||||
if ($this->currentUser === 'admin') {
|
||||
$options['auth'] = ['admin', 'admin'];
|
||||
} elseif (strpos($this->currentUser, 'guest') !== 0) {
|
||||
$options['auth'] = [$this->currentUser, self::TEST_PASSWORD];
|
||||
} elseif (strpos($this->currentUser, 'anonymous') !== 0) {
|
||||
$options['auth'] = [$this->currentUser, $this->regularUser];
|
||||
}
|
||||
if ($body instanceof TableNode) {
|
||||
$fd = $body->getRowsHash();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class SharingContext implements Context, SnippetAcceptingContext {
|
|||
use Trashbin;
|
||||
use AppConfiguration;
|
||||
use CommandLine;
|
||||
use Activity;
|
||||
|
||||
protected function resetAppConfigs() {
|
||||
$this->deleteServerConfig('core', 'shareapi_default_permissions');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Feature: sharing
|
|||
| notify_setting_batchtime | 0 |
|
||||
| activity_digest | 0 |
|
||||
|
||||
Scenario: Creating a new mail share
|
||||
Scenario: Creating a new mail share and check activity
|
||||
Given dummy mail server is listening
|
||||
And As an "user0"
|
||||
When creating a share with
|
||||
|
|
@ -24,8 +24,13 @@ Feature: sharing
|
|||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And last share can be downloaded
|
||||
Then last activity should be
|
||||
| app | files_sharing |
|
||||
| type | public_links |
|
||||
| object_type | files |
|
||||
| object_name | /welcome.txt |
|
||||
|
||||
Scenario: Creating a new public share
|
||||
Scenario: Creating a new public share and check activity
|
||||
Given user "user0" exists
|
||||
And As an "user0"
|
||||
When creating a share with
|
||||
|
|
@ -34,3 +39,8 @@ Feature: sharing
|
|||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And last link share can be downloaded
|
||||
Then last activity should be
|
||||
| app | files_sharing |
|
||||
| type | public_links |
|
||||
| object_type | files |
|
||||
| object_name | /welcome.txt |
|
||||
|
|
|
|||
Loading…
Reference in a new issue