Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] Store share invite response #10994

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions tests/acceptance/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function createLinkShare(string $user, TableNode $body): ResponseInterfac
'password' => $this->featureContext->getActualPassword($bodyRows['password'])
];

return GraphHelper::createLinkShare(
$response = GraphHelper::createLinkShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
Expand All @@ -110,6 +110,12 @@ public function createLinkShare(string $user, TableNode $body): ResponseInterfac
$itemId,
\json_encode($body)
);

if ($response->getStatusCode() == 200) {
$this->featureContext->shareNgAddToCreatedLinkShares($response);
}

return $response;
}

/**
Expand Down Expand Up @@ -681,7 +687,7 @@ public function updateResourceShare(string $user, TableNode $body, string $perm
? null : $bodyRows['expirationDateTime'];
}

return GraphHelper::updateShare(
$response = GraphHelper::updateShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
Expand All @@ -691,6 +697,12 @@ public function updateResourceShare(string $user, TableNode $body, string $perm
\json_encode($body),
$permissionID
);

if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for update response, we should update the share instead of adding to the list. Check if shareNgAddToCreatedUserGroupShares method updates the share data properly

Suggested change
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);

}

return $response;
}

/**
Expand Down Expand Up @@ -763,7 +775,6 @@ public function userHasCreatedTheFollowingResourceLinkShare(string $user, TableN
);
$response = $this->createLinkShare($user, $body);
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
amrita-shrestha marked this conversation as resolved.
Show resolved Hide resolved
$this->featureContext->shareNgAddToCreatedLinkShares($response);
}

/**
Expand Down Expand Up @@ -859,7 +870,7 @@ public function updateLinkShare(string $user, TableNode $body, string $permissi
$body['displayName'] = $bodyRows['displayName'];
}

return GraphHelper::updateShare(
$response = GraphHelper::updateShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
Expand All @@ -869,6 +880,12 @@ public function updateLinkShare(string $user, TableNode $body, string $permissi
\json_encode($body),
$permissionID
);

if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedLinkShares($response);
}

return $response;
}

/**
Expand All @@ -894,7 +911,7 @@ public function setLinkSharePassword(string $user, TableNode $body, string $per
throw new Error('Password is missing to set for share link!');
}

return GraphHelper::setLinkSharePassword(
$response = GraphHelper::setLinkSharePassword(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
Expand All @@ -904,6 +921,11 @@ public function setLinkSharePassword(string $user, TableNode $body, string $per
\json_encode($body),
$permissionID
);

if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedLinkShares($response);
}
return $response;
}

/**
Expand Down
26 changes: 15 additions & 11 deletions tests/acceptance/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2666,18 +2666,22 @@ public function userExpiresTheLastShareOfResourceInsideOfTheSpace(
$itemId = $this->getResourceId($user, $spaceName, $resource);
$body['expirationDateTime'] = $rows['expireDate'];
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$this->featureContext->setResponse(
GraphHelper::updateShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"],
$itemId,
\json_encode($body),
$permissionID
)
$response = GraphHelper::updateShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"],
$itemId,
\json_encode($body),
$permissionID
);

if ($response->getStatusCode() === 200) {
$this->featureContext->shareNgAddToCreatedUserGroupShares($response);
}
$this->featureContext->setResponse($response);

} else {
$rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions;
$this->featureContext->setResponse($this->updateSharedResource($user, $rows));
Expand Down