Merge pull request #10988 from owncloud/create-auth-app-without-exp-cli

[tests-only][full-ci] adding test for trying to create auth app-token without expiry using cli
This commit is contained in:
nirajacharya2 authored and GitHub committed 2025-03-28 12:48:52 +05:45
commit aa36d63ce9
2 files changed
+20 -4

No files matched your search

+14 -4
View File
@@ -129,6 +129,7 @@ class CliContext implements Context {
/**
* @When the administrator creates auth-app token for user :user with expiration time :expirationTime using the auth-app CLI
* @When the administrator tries to create auth-app token for user :user with expiration time :expirationTime using the auth-app CLI
*
* @param string $user
* @param string $expirationTime
@@ -287,19 +288,28 @@ class CliContext implements Context {
}
/**
* @Then the command should be successful
* @Then /^the command should be (successful|unsuccessful)$/
*
* @param string $successfulOrNot
*
* @return void
*/
public function theCommandShouldBeSuccessful(): void {
public function theCommandShouldBeSuccessful(string $successfulOrNot): void {
$response = $this->featureContext->getResponse();
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
$jsonResponse = $this->featureContext->getJsonDecodedResponse($response);
Assert::assertSame("OK", $jsonResponse["status"]);
$expectedStatus = 'OK';
$expectedExitCode = 0;
if ($successfulOrNot === "unsuccessful") {
$expectedStatus = "ERROR";
$expectedExitCode = 1;
}
Assert::assertSame($expectedStatus, $jsonResponse["status"]);
Assert::assertSame(
0,
$expectedExitCode,
$jsonResponse["exitCode"],
"Expected exit code to be 0, but got " . $jsonResponse["exitCode"]
);
@@ -34,3 +34,9 @@ Feature: create auth-app token
"maxItems": 0
}
"""
Scenario: try to create auth-app token without expiry
When the administrator tries to create auth-app token for user "Alice" with expiration time "" using the auth-app CLI
Then the command should be unsuccessful
And the command output should contain "time: invalid duration"