Add integration tests for setting the password and joining without it

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-09-22 15:34:59 +02:00
Родитель 12332361d6
Коммит 87bfc885bd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E166FD8976B3BAC8
2 изменённых файлов: 75 добавлений и 0 удалений

Просмотреть файл

@ -221,6 +221,23 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$this->assertStatusCode($this->response, $statusCode);
}
/**
* @When /^user "([^"]*)" sets password "([^"]*)" for room "([^"]*)" with (\d+)$/
*
* @param string $user
* @param string $password
* @param string $identifier
* @param string $statusCode
*/
public function userSetsTheRoomPassword($user, $password, $identifier, $statusCode) {
$this->setCurrentUser($user);
$this->sendRequest(
'PUT', '/apps/spreed/api/v1/room/' . self::$identifierToToken[$identifier] . '/password',
new TableNode([['password', $password]])
);
$this->assertStatusCode($this->response, $statusCode);
}
/**
* @Then /^user "([^"]*)" makes room "([^"]*)" (public|private) with (\d+)$/
*

Просмотреть файл

@ -0,0 +1,58 @@
Feature: public
Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists
Scenario: Owner sets a room password
Given user "participant1" creates room "room"
| roomType | 3 |
And user "participant1" is participant of the following rooms
| id | type | participantType | participants |
| room | 3 | 1 | participant1-displayname |
When user "participant1" sets password "foobar" for room "room" with 200
Then user "participant3" joins call "room" with 403
When user "participant1" sets password "" for room "room" with 200
Then user "participant3" joins call "room" with 200
Scenario: Moderator sets a room password
Given user "participant1" creates room "room"
| roomType | 3 |
And user "participant1" is participant of the following rooms
| id | type | participantType | participants |
| room | 3 | 1 | participant1-displayname |
And user "participant1" adds "participant2" to room "room" with 200
And user "participant1" promotes "participant2" in room "room" with 200
When user "participant2" sets password "foobar" for room "room" with 200
Then user "participant3" joins call "room" with 403
When user "participant2" sets password "" for room "room" with 200
Then user "participant3" joins call "room" with 200
Scenario: User sets a room password
Given user "participant1" creates room "room"
| roomType | 3 |
And user "participant1" is participant of the following rooms
| id | type | participantType | participants |
| room | 3 | 1 | participant1-displayname |
And user "participant1" adds "participant2" to room "room" with 200
When user "participant2" sets password "foobar" for room "room" with 403
Then user "participant3" joins call "room" with 200
And user "participant3" leaves call "room" with 200
When user "participant1" sets password "foobar" for room "room" with 200
Then user "participant3" joins call "room" with 403
When user "participant2" sets password "" for room "room" with 403
Then user "participant3" joins call "room" with 403
Scenario: Stranger sets a room password
Given user "participant1" creates room "room"
| roomType | 3 |
And user "participant1" is participant of the following rooms
| id | type | participantType | participants |
| room | 3 | 1 | participant1-displayname |
When user "participant2" sets password "foobar" for room "room" with 404
Then user "participant3" joins call "room" with 200
And user "participant3" leaves call "room" with 200
When user "participant1" sets password "foobar" for room "room" with 200
Then user "participant3" joins call "room" with 403
When user "participant2" sets password "" for room "room" with 404
Then user "participant3" joins call "room" with 403