diff options
author | Joas Schilling <coding@schilljs.com> | 2024-04-29 10:47:56 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-04-29 11:25:19 +0200 |
commit | 889672948dc1ff81296fb0f8818a6a82a323a1d5 (patch) | |
tree | 4384d2f06874743d2d716d45cee9b58e9472e4ba | |
parent | 2a43ff79ab00c16dc30279b1c2e85109ae5cc41a (diff) |
test(teams): Add a test to check if "Shared with team" allows chattingbugfix/noid/allow-file-chat-when-shared-with-team
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | .github/workflows/integration-mysql.yml | 9 | ||||
-rw-r--r-- | .github/workflows/integration-oci.yml | 9 | ||||
-rw-r--r-- | .github/workflows/integration-pgsql.yml | 9 | ||||
-rw-r--r-- | .github/workflows/integration-sqlite.yml | 9 | ||||
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 41 | ||||
-rw-r--r-- | tests/integration/features/bootstrap/SharingContext.php | 25 | ||||
-rw-r--r-- | tests/integration/features/conversation-2/files.feature | 10 | ||||
-rwxr-xr-x | tests/integration/run.sh | 4 |
8 files changed, 116 insertions, 0 deletions
diff --git a/.github/workflows/integration-mysql.yml b/.github/workflows/integration-mysql.yml index 49a3cbff5..a92987142 100644 --- a/.github/workflows/integration-mysql.yml +++ b/.github/workflows/integration-mysql.yml @@ -58,6 +58,7 @@ jobs: php-versions: ['8.2'] server-versions: ['master'] guests-versions: ['master'] + circles-versions: ['master'] call-summary-bot-versions: ['main'] notifications-versions: ['master'] @@ -95,6 +96,13 @@ jobs: path: apps/call_summary_bot ref: ${{ matrix.call-summary-bot-versions }} + - name: Checkout circles app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: nextcloud/circles + path: apps/circles + ref: ${{ matrix.circles-versions }} + - name: Checkout guests app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -137,6 +145,7 @@ jobs: ./occ config:system:set hashing_default_password --value=true --type=boolean ./occ app:enable --force ${{ env.APP_NAME }} ./occ app:enable --force call_summary_bot + ./occ app:enable --force circles ./occ app:enable --force guests ./occ app:enable --force notifications diff --git a/.github/workflows/integration-oci.yml b/.github/workflows/integration-oci.yml index eaba42531..a2c6291b0 100644 --- a/.github/workflows/integration-oci.yml +++ b/.github/workflows/integration-oci.yml @@ -58,6 +58,7 @@ jobs: php-versions: ['8.2'] server-versions: ['master'] guests-versions: ['master'] + circles-versions: ['master'] call-summary-bot-versions: ['main'] notifications-versions: ['master'] @@ -107,6 +108,13 @@ jobs: path: apps/call_summary_bot ref: ${{ matrix.call-summary-bot-versions }} + - name: Checkout circles app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: nextcloud/circles + path: apps/circles + ref: ${{ matrix.circles-versions }} + - name: Checkout guests app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -149,6 +157,7 @@ jobs: ./occ config:system:set hashing_default_password --value=true --type=boolean ./occ app:enable --force ${{ env.APP_NAME }} ./occ app:enable --force call_summary_bot + ./occ app:enable --force circles ./occ app:enable --force guests ./occ app:enable --force notifications diff --git a/.github/workflows/integration-pgsql.yml b/.github/workflows/integration-pgsql.yml index 82610c9ba..0808d15ad 100644 --- a/.github/workflows/integration-pgsql.yml +++ b/.github/workflows/integration-pgsql.yml @@ -55,6 +55,7 @@ jobs: php-versions: ['8.3'] server-versions: ['master'] guests-versions: ['master'] + circles-versions: ['master'] call-summary-bot-versions: ['main'] notifications-versions: ['master'] @@ -98,6 +99,13 @@ jobs: path: apps/call_summary_bot ref: ${{ matrix.call-summary-bot-versions }} + - name: Checkout circles app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: nextcloud/circles + path: apps/circles + ref: ${{ matrix.circles-versions }} + - name: Checkout guests app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -144,6 +152,7 @@ jobs: ./occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu" ./occ app:enable --force ${{ env.APP_NAME }} ./occ app:enable --force call_summary_bot + ./occ app:enable --force circles ./occ app:enable --force guests ./occ app:enable --force notifications diff --git a/.github/workflows/integration-sqlite.yml b/.github/workflows/integration-sqlite.yml index fcb28dc93..4c04c1db3 100644 --- a/.github/workflows/integration-sqlite.yml +++ b/.github/workflows/integration-sqlite.yml @@ -58,6 +58,7 @@ jobs: php-versions: ['8.2'] server-versions: ['master'] guests-versions: ['master'] + circles-versions: ['master'] call-summary-bot-versions: ['main'] notifications-versions: ['master'] @@ -86,6 +87,13 @@ jobs: path: apps/call_summary_bot ref: ${{ matrix.call-summary-bot-versions }} + - name: Checkout circles app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: nextcloud/circles + path: apps/circles + ref: ${{ matrix.circles-versions }} + - name: Checkout guests app uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: @@ -128,6 +136,7 @@ jobs: ./occ config:system:set hashing_default_password --value=true --type=boolean ./occ app:enable --force ${{ env.APP_NAME }} ./occ app:enable --force call_summary_bot + ./occ app:enable --force circles ./occ app:enable --force guests ./occ app:enable --force notifications diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index c90a9711b..6a0a39bd5 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -59,6 +59,8 @@ class FeatureContext implements Context, SnippetAcceptingContext { protected static ?array $nextChatRequestParameters = null; /** @var array<string, int> */ protected static array $modifiedSince; + /** @var array<string, string> */ + protected static array $createdTeams = []; protected static array $permissionsMap = [ @@ -111,6 +113,10 @@ class FeatureContext implements Context, SnippetAcceptingContext { return self::$identifierToToken[$identifier]; } + public static function getTeamIdForLabel(string $label): string { + return self::$createdTeams[$label] ?? throw new \RuntimeException('Unknown team: ' . $label); + } + public static function getMessageIdForText(string $text): int { return self::$textToMessageId[$text]; } @@ -175,6 +181,7 @@ class FeatureContext implements Context, SnippetAcceptingContext { $this->createdUsers = []; $this->createdGroups = []; + self::$createdTeams = []; $this->createdGuestAccountUsers = []; } @@ -197,6 +204,9 @@ class FeatureContext implements Context, SnippetAcceptingContext { foreach ($this->createdGroups as $group) { $this->deleteGroup($group); } + foreach (self::$createdTeams as $team => $id) { + $this->deleteTeam($team); + } foreach ($this->createdGuestAccountUsers as $user) { $this->deleteGuestUser($user); } @@ -3600,6 +3610,37 @@ class FeatureContext implements Context, SnippetAcceptingContext { } /** + * @Given /^team "([^"]*)" exists$/ + */ + public function assureTeamExists(string $team): void { + $this->runOcc(['circles:manage:create', '--type', '1', '--output', 'json', 'admin', $team]); + $this->theCommandWasSuccessful(); + + $output = $this->getLastStdOut(); + $data = json_decode($output, true); + + self::$createdTeams[$team] = $data['id']; + } + + /** + * @Given /^add user "([^"]*)" to team "([^"]*)"$/ + */ + public function addTeamMember(string $user, string $team): void { + $this->runOcc(['circles:members:add', '--type', '1', self::$createdTeams[$team], $user]); + $this->theCommandWasSuccessful(); + } + + /** + * @Given /^delete team "([^"]*)"$/ + */ + public function deleteTeam(string $team): void { + $this->runOcc(['circles:manage:destroy', self::$createdTeams[$team]]); + $this->theCommandWasSuccessful(); + + unset(self::$createdTeams[$team]); + } + + /** * @Given /^user "([^"]*)" is a guest account user/ * @param string $email email address */ diff --git a/tests/integration/features/bootstrap/SharingContext.php b/tests/integration/features/bootstrap/SharingContext.php index 665e2a2f0..cfcc06f85 100644 --- a/tests/integration/features/bootstrap/SharingContext.php +++ b/tests/integration/features/bootstrap/SharingContext.php @@ -145,6 +145,31 @@ class SharingContext implements Context { } /** + * @When user :user shares :path with team :sharee + * + * @param string $user + * @param string $path + * @param string $sharee + * @param TableNode|null $body + */ + public function userSharesWithTeam(string $user, string $path, string $sharee, TableNode $body = null) { + $this->userSharesWith($user, $path, 7 /*IShare::TYPE_CIRCLE*/, $sharee, $body); + } + + /** + * @When user :user shares :path with team :sharee with OCS :statusCode + * + * @param string $user + * @param string $path + * @param string $sharee + * @param int $statusCode + */ + public function userSharesWithTeamWithOcs(string $user, string $path, string $sharee, int $statusCode) { + $this->userSharesWithTeam($user, $path, FeatureContext::getTeamIdForLabel($sharee)); + $this->theOCSStatusCodeShouldBe($statusCode); + } + + /** * @When user :user shares :path with room :room * * @param string $user diff --git a/tests/integration/features/conversation-2/files.feature b/tests/integration/features/conversation-2/files.feature index d8a4aeb17..a2e16ce64 100644 --- a/tests/integration/features/conversation-2/files.feature +++ b/tests/integration/features/conversation-2/files.feature @@ -83,6 +83,16 @@ Feature: conversation/files And user "participant3" is not participant of room "file welcome (2).txt room" (v4) + Scenario: get room for file shared with team + Given team "team1" exists + And add user "participant1" to team "team1" + And add user "participant2" to team "team1" + And user "participant1" shares "welcome.txt" with team "team1" with OCS 100 + When user "participant1" gets the room for path "welcome.txt" with 200 (v1) + And user "participant2" gets the room for path "welcome (2).txt" with 200 (v1) + Then user "participant1" is not participant of room "file welcome (2).txt room" (v4) + And user "participant2" is not participant of room "file welcome (2).txt room" (v4) + Scenario: get room for link share Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100 diff --git a/tests/integration/run.sh b/tests/integration/run.sh index c15f037d1..2791caf92 100755 --- a/tests/integration/run.sh +++ b/tests/integration/run.sh @@ -8,6 +8,7 @@ PROCESS_ID=$$ APP_NAME=spreed NOTIFICATIONS_BRANCH="master" GUESTS_BRANCH="master" +CIRCLES_BRANCH="master" CSB_BRANCH="main" APP_INTEGRATION_DIR=$PWD @@ -71,17 +72,20 @@ ${ROOT_DIR}/occ app:getpath spreedcheats # already there or in "apps"). ${ROOT_DIR}/occ app:getpath notifications || (cd ../../../ && git clone --depth 1 --branch ${NOTIFICATIONS_BRANCH} https://github.com/nextcloud/notifications) ${ROOT_DIR}/occ app:getpath guests || (cd ../../../ && git clone --depth 1 --branch ${GUESTS_BRANCH} https://github.com/nextcloud/guests) +${ROOT_DIR}/occ app:getpath circles || (cd ../../../ && git clone --depth 1 --branch ${CIRCLES_BRANCH} https://github.com/nextcloud/circles) ${ROOT_DIR}/occ app:getpath call_summary_bot || (cd ../../../ && git clone --depth 1 --branch ${CSB_BRANCH} https://github.com/nextcloud/call_summary_bot) ${ROOT_DIR}/occ app:enable spreed || exit 1 ${ROOT_DIR}/occ app:enable --force spreedcheats || exit 1 ${ROOT_DIR}/occ app:enable --force notifications || exit 1 ${ROOT_DIR}/occ app:enable --force guests || exit 1 +${ROOT_DIR}/occ app:enable --force circles || exit 1 ${ROOT_DIR}/occ app:enable --force call_summary_bot || exit 1 ${ROOT_DIR}/occ app:list | grep spreed ${ROOT_DIR}/occ app:list | grep notifications ${ROOT_DIR}/occ app:list | grep guests +${ROOT_DIR}/occ app:list | grep circles ${ROOT_DIR}/occ app:list | grep call_summary_bot echo '' |