mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
adding test for create token for non-existing user and deleting token by a different user
This commit is contained in:
@@ -33,6 +33,7 @@ require_once 'bootstrap.php';
|
||||
*/
|
||||
class AuthAppContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
private string $lastCreatedToken;
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
@@ -83,6 +84,7 @@ class AuthAppContext implements Context {
|
||||
["expiry" => $expiration]
|
||||
);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
|
||||
$this->lastCreatedToken = json_decode($response->getBody()->getContents())->token;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,6 +133,7 @@ class AuthAppContext implements Context {
|
||||
. "HTTP status code 200 is not the expected value " . $response->getStatusCode(),
|
||||
$response
|
||||
);
|
||||
$this->lastCreatedToken = json_decode($response->getBody()->getContents())->token;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,4 +240,24 @@ class AuthAppContext implements Context {
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @When user :user tries to delete the last created auth-app token using the auth-app API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userTriesToDeleteLastCreatedAuthAppTokensUsingTheAuthAppApi(string $user): void {
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$password = $this->featureContext->getPasswordForUser($user);
|
||||
$deleteResponse = AuthAppHelper::deleteAppAuthToken(
|
||||
$baseUrl,
|
||||
$user,
|
||||
$password,
|
||||
$this->lastCreatedToken,
|
||||
);
|
||||
$this->featureContext->setResponse($deleteResponse);
|
||||
$this->featureContext->pushToLastHttpStatusCodesArray((string)$deleteResponse->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user