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:
authorVitor Mattos <vitor@php.rio>2022-03-16 18:41:07 +0300
committerVitor Mattos <vitor@php.rio>2022-03-16 18:57:55 +0300
commitb4ac82b00e5cfbeff0558c66d66408da65151431 (patch)
tree88d72844e3963f958867e6551378eb04fbc64c96 /tests
parentc50e4a6d157cf219223b90384bc92786ca1a7f79 (diff)
Reduce integration tests queriesfeature/reduce-integration-tests-queries
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php31
1 files changed, 14 insertions, 17 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 90f9d5e08..e06ccef46 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2083,28 +2083,25 @@ class FeatureContext implements Context, SnippetAcceptingContext {
* @param string $group
*/
public function assureGroupExists($group) {
- $response = $this->groupExists($group);
- if ($response->getStatusCode() !== 200) {
- $this->createGroup($group);
- $response = $this->groupExists($group);
- $this->assertStatusCode($response, 200);
- }
- }
-
- private function groupExists($group) {
- $currentUser = $this->currentUser;
- $this->setCurrentUser('admin');
- $this->sendRequest('GET', '/cloud/groups/' . $group);
- $this->setCurrentUser($currentUser);
- return $this->response;
- }
-
- private function createGroup($group) {
$currentUser = $this->currentUser;
$this->setCurrentUser('admin');
$this->sendRequest('POST', '/cloud/groups', [
'groupid' => $group,
]);
+
+ $jsonBody = json_decode($this->response->getBody()->getContents(), true);
+ if (isset($jsonBody['ocs']['meta'])) {
+ // 102 = group exists
+ // 200 = created with success
+ Assert::assertContains(
+ $jsonBody['ocs']['meta']['statuscode'],
+ [102, 200],
+ $jsonBody['ocs']['meta']['message']
+ );
+ } else {
+ throw new \Exception('Invalid response when create group');
+ }
+
$this->setCurrentUser($currentUser);
$this->createdGroups[] = $group;