Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-13 05:02:47 +0300
committerJoas Schilling <coding@schilljs.com>2020-11-30 15:48:01 +0300
commit21ce9a0231d9e62f28bcce808a5b89183f65e2fd (patch)
tree2ba74d84bbf2c3298c46326ade9c83b8ba8798b6 /tests
parent6caf1a4b9dd6f2947183d116a2cef86b1a8a8bef (diff)
Make possible to fetch room data with a specific API version
By default API version 1 will be used. To use a specific API version " (v1)", " (v2)" or " (v3)" can be appended to the step name. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 232b7d123..7ef6565f9 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -124,14 +124,14 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^user "([^"]*)" is participant of the following rooms$/
+ * @Then /^user "([^"]*)" is participant of the following rooms(?: \((v(1|2|3))\))?$/
*
* @param string $user
* @param TableNode|null $formData
*/
- public function userIsParticipantOfRooms($user, TableNode $formData = null) {
+ public function userIsParticipantOfRooms($user, $apiVersion = 'v1', TableNode $formData = null) {
$this->setCurrentUser($user);
- $this->sendRequest('GET', '/apps/spreed/api/v1/room');
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room');
$this->assertStatusCode($this->response, 200);
$rooms = $this->getDataFromResponse($this->response);
@@ -207,22 +207,22 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^user "([^"]*)" (is|is not) participant of room "([^"]*)"$/
+ * @Then /^user "([^"]*)" (is|is not) participant of room "([^"]*)"(?: \((v(1|2|3))\))?$/
*
* @param string $user
* @param string $isOrNotParticipant
* @param string $identifier
* @param TableNode|null $formData
*/
- public function userIsParticipantOfRoom($user, $isOrNotParticipant, $identifier, TableNode $formData = null) {
+ public function userIsParticipantOfRoom($user, $isOrNotParticipant, $identifier, $apiVersion = 'v1', TableNode $formData = null) {
if (strpos($user, 'guest') === 0) {
- $this->guestIsParticipantOfRoom($user, $isOrNotParticipant, $identifier, $formData);
+ $this->guestIsParticipantOfRoom($user, $isOrNotParticipant, $identifier, $apiVersion, $formData);
return;
}
$this->setCurrentUser($user);
- $this->sendRequest('GET', '/apps/spreed/api/v1/room');
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room');
$this->assertStatusCode($this->response, 200);
$isParticipant = $isOrNotParticipant === 'is';
@@ -242,7 +242,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
Assert::assertEquals($isParticipant, true, 'Room ' . $identifier . ' found in user´s room list');
if ($formData) {
- $this->sendRequest('GET', '/apps/spreed/api/v1/room/' . self::$identifierToToken[$identifier]);
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier]);
$rooms = [$this->getDataFromResponse($this->response)];
@@ -260,11 +260,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @param string $guest
* @param string $isOrNotParticipant
* @param string $identifier
+ * @param string $apiVersion
* @param TableNode|null $formData
*/
- private function guestIsParticipantOfRoom($guest, $isOrNotParticipant, $identifier, TableNode $formData = null) {
+ private function guestIsParticipantOfRoom($guest, $isOrNotParticipant, $identifier, $apiVersion = 'v1', TableNode $formData = null) {
$this->setCurrentUser($guest);
- $this->sendRequest('GET', '/apps/spreed/api/v1/room/' . self::$identifierToToken[$identifier]);
+ $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier]);
$response = $this->getDataFromResponse($this->response);