Skip to content

Commit

Permalink
Update guest account tests for updated guests:add command
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Dec 17, 2020
1 parent a384b3f commit d9a0ae7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 47 deletions.
16 changes: 7 additions & 9 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1576,31 +1576,29 @@ public function assureUserExists($user) {

/**
* @Given /^user "([^"]*)" is a guest account user/
* @param string $user
* @param string $email email address
*/
public function createGuestUser($user) {
public function createGuestUser($email) {
$currentUser = $this->currentUser;
$this->setCurrentUser('admin');
// in case it exists
$this->deleteUser($user);
$this->deleteUser($email);

$lastCode = $this->runOcc([
'guests:add',
// creator user
'admin',
// guest user id
$user,
// email
$user . '@localhost',
$email,
'--display-name',
$user . '-displayname',
$email . '-displayname',
'--password-from-env',
], [
'OC_PASS' => self::TEST_PASSWORD,
]);
Assert::assertEquals(0, $lastCode, 'Guest creation succeeded for ' . $user);
Assert::assertEquals(0, $lastCode, 'Guest creation succeeded for ' . $email);

$this->createdGuestAccountUsers[] = $user;
$this->createdGuestAccountUsers[] = $email;
$this->setCurrentUser($currentUser);
}

Expand Down
18 changes: 9 additions & 9 deletions tests/integration/features/conversation/find-listed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: conversation/find-listed
Given user "creator" exists
And user "regular-user" exists
And guest accounts can be created
And user "user-guest" is a guest account user
And user "user-guest@example.com" is a guest account user

Scenario Outline: Nobody can find non-listed rooms
Given user "creator" creates room "group-room"
Expand All @@ -16,10 +16,10 @@ Feature: conversation/find-listed
And user "creator" allows listing room "public-room" for "none" with 200
Then user "creator" cannot find any listed rooms (v3)
Examples:
| user |
| creator |
| regular-user |
| user-guest |
| user |
| creator |
| regular-user |
| user-guest@example.com |

Scenario: Regular users can find user-listed rooms
Given user "creator" creates room "group-room"
Expand All @@ -34,7 +34,7 @@ Feature: conversation/find-listed
| name | listable |
| group-room | 1 |
| public-room | 1 |
And user "user-guest" cannot find any listed rooms (v3)
And user "user-guest@example.com" cannot find any listed rooms (v3)

Scenario: All users can find all-listed rooms
Given user "creator" creates room "group-room"
Expand All @@ -49,7 +49,7 @@ Feature: conversation/find-listed
| name | listable |
| group-room | 2 |
| public-room | 2 |
And user "user-guest" can find listed rooms (v3)
And user "user-guest@example.com" can find listed rooms (v3)
| name | listable |
| group-room | 2 |
| public-room | 2 |
Expand Down Expand Up @@ -101,7 +101,7 @@ Feature: conversation/find-listed
| name | listable |
| group-the-cool-room | 2 |
| public-the-cool-room | 2 |
And user "user-guest" can find listed rooms with term "cool" (v3)
And user "user-guest@example.com" can find listed rooms with term "cool" (v3)
| name | listable |
| group-the-cool-room | 2 |
| public-the-cool-room | 2 |
Expand All @@ -112,7 +112,7 @@ Feature: conversation/find-listed
| roomName | group-room |
When user "creator" allows listing room "group-room" for "all" with 200
Then user "regular-user" cannot find any listed rooms with term "cool" (v3)
And user "user-guest" cannot find any listed rooms with term "cool" (v3)
And user "user-guest@example.com" cannot find any listed rooms with term "cool" (v3)

Scenario: Guest users without accounts cannot search for listed rooms
Given user "creator" creates room "public-room"
Expand Down
52 changes: 26 additions & 26 deletions tests/integration/features/conversation/join-listable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: conversation/join-listable
Given user "creator" exists
And user "regular-user" exists
And guest accounts can be created
And user "user-guest" is a guest account user
And user "user-guest@example.com" is a guest account user
# implicit: And user "guest" is a guest user with no account

# -----------------------------------------------------------------------------
Expand All @@ -15,7 +15,7 @@ Feature: conversation/join-listable
| roomName | room |
When user "creator" allows listing room "room" for "none" with 200
Then user "regular-user" joins room "room" with 404
And user "user-guest" joins room "room" with 404
And user "user-guest@example.com" joins room "room" with 404
And user "guest" joins room "room" with 404

Scenario: Anyone can join a non-listed public room
Expand All @@ -24,14 +24,14 @@ Feature: conversation/join-listable
| roomName | room |
And user "creator" allows listing room "room" for "none" with 200
When user "regular-user" joins room "room" with 200
And user "user-guest" joins room "room" with 200
And user "user-guest@example.com" joins room "room" with 200
And user "guest" joins room "room" with 200
Then user "creator" sees the following attendees in room "room" with 200 (v3)
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER_SELF_JOINED | users |
| user-guest | USER_SELF_JOINED | users |
| "guest" | GUEST | guests |
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER_SELF_JOINED | users |
| user-guest@example.com | USER_SELF_JOINED | users |
| "guest" | GUEST | guests |

# -----------------------------------------------------------------------------
# User-listed rooms
Expand All @@ -42,7 +42,7 @@ Feature: conversation/join-listable
| roomName | room |
And user "creator" allows listing room "room" for "users" with 200
When user "regular-user" joins room "room" with 200
And user "user-guest" joins room "room" with 404
And user "user-guest@example.com" joins room "room" with 404
And user "guest" joins room "room" with 404
Then user "creator" sees the following attendees in room "room" with 200 (v3)
| actorId | participantType | actorType |
Expand All @@ -55,14 +55,14 @@ Feature: conversation/join-listable
| roomName | room |
And user "creator" allows listing room "room" for "users" with 200
When user "regular-user" joins room "room" with 200
And user "user-guest" joins room "room" with 200
And user "user-guest@example.com" joins room "room" with 200
And user "guest" joins room "room" with 200
Then user "creator" sees the following attendees in room "room" with 200 (v3)
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest | USER_SELF_JOINED | users |
| "guest" | GUEST | guests |
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest@example.com | USER_SELF_JOINED | users |
| "guest" | GUEST | guests |

# -----------------------------------------------------------------------------
# All-listed rooms
Expand All @@ -73,25 +73,25 @@ Feature: conversation/join-listable
| roomName | room |
And user "creator" allows listing room "room" for "all" with 200
When user "regular-user" joins room "room" with 200
And user "user-guest" joins room "room" with 200
And user "user-guest@example.com" joins room "room" with 200
And user "guest" joins room "room" with 404
Then user "creator" sees the following attendees in room "room" with 200 (v3)
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest | USER | users |
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest@example.com | USER | users |

Scenario: Anyone can join an all-listed public room
Given user "creator" creates room "room"
| roomType | 3 |
| roomName | room |
And user "creator" allows listing room "room" for "all" with 200
When user "regular-user" joins room "room" with 200
And user "user-guest" joins room "room" with 200
And user "user-guest@example.com" joins room "room" with 200
And user "guest" joins room "room" with 200
Then user "creator" sees the following attendees in room "room" with 200 (v3)
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest | USER | users |
| "guest" | GUEST | guests |
| actorId | participantType | actorType |
| creator | OWNER | users |
| regular-user | USER | users |
| user-guest@example.com | USER | users |
| "guest" | GUEST | guests |
6 changes: 3 additions & 3 deletions tests/integration/features/conversation/set-listable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ Feature: conversation/set-listable
| roomName | room |
And user "moderator" exists
And guest accounts can be created
And user "user-guest" is a guest account user
And user "user-guest@example.com" is a guest account user
And user "creator" adds "regular-user" to room "room" with 200
And user "creator" adds "moderator" to room "room" with 200
And user "creator" allows listing room "room" for "all" with 200
When user "creator" promotes "moderator" in room "room" with 200
And user "user-guest" joins room "room" with 200
And user "user-guest@example.com" joins room "room" with 200
And user "guest" joins room "room" with 200
Then user "moderator" allows listing room "room" for "none" with 200
And user "regular-user" allows listing room "room" for "users" with 403
And user "user-guest" allows listing room "room" for "users" with 403
And user "user-guest@example.com" allows listing room "room" for "users" with 403
And user "guest" allows listing room "room" for "users" with 401

Scenario: Cannot change listable attribute of one to one conversations
Expand Down

0 comments on commit d9a0ae7

Please sign in to comment.