Skip to content

Commit 84f90fc

Browse files
authored
Merge pull request #104 from LibreSign/feat/add-create-guest
feat: add create guest
2 parents 3b75b9f + b35cbe4 commit 84f90fc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Given as user :user
5252
Given user :user exists
5353
Given sending :verb to :url
5454
Given the response should be a JSON array with the following mandatory values
55+
Given guest :guest exists
5556
Given /^set the display name of user "([^"]*)" to "([^"]*)"$/
5657
Given /^set the email of user "([^"]*)" to "([^"]*)"$/
5758
Given sending :verb to ocs :url

src/NextcloudApiContext.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ public function assureUserExists(string $user): void {
9494
}
9595
}
9696

97+
#[Given('guest :guest exists')]
98+
public function assureGuestExists(string $guest): void {
99+
$response = $this->userExists($guest);
100+
if ($response->getStatusCode() !== 200) {
101+
static::createAnEnvironmentWithValueToBeUsedByOccCommand('OC_PASS', '123456');
102+
$this->runCommandWithResultCode('guests:add admin ' . $guest . ' --password-from-env', 0);
103+
// Set a display name different than the user ID to be able to
104+
// ensure in the tests that the right value was returned.
105+
$this->setUserDisplayName($guest);
106+
self::$createdUsers[] = $guest;
107+
}
108+
}
109+
97110
protected function userExists(string $user): ResponseInterface {
98111
$currentUser = $this->currentUser;
99112
$this->setCurrentUser('admin');

0 commit comments

Comments
 (0)