Skip to content

Commit

Permalink
testUpdateSubmission: use different http client for user1
Browse files Browse the repository at this point in the history
Signed-off-by: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
  • Loading branch information
tpokorra committed Jan 22, 2025
1 parent 23b3e0b commit 94c7f4c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/Integration/Api/ApiV3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
class ApiV3Test extends IntegrationBase {
/** @var GuzzleHttp\Client */
private $http;
/** @var GuzzleHttp\Client */
private $httpUser1;

protected array $users = [
'test' => 'Test user',
Expand Down Expand Up @@ -255,6 +257,16 @@ public function setUp(): void {
'Accept' => 'application/json'
],
]);

// Set up http Client for user user1
$this->httpUser1 = new Client([
'base_uri' => 'http://localhost:8080/ocs/v2.php/apps/forms/',
'auth' => ['user1', 'test'],
'headers' => [
'OCS-ApiRequest' => 'true',
'Accept' => 'application/json'
],
]);
}

public function tearDown(): void {
Expand Down Expand Up @@ -1365,7 +1377,7 @@ public function testUpdateSubmission() {
]
]);

$uploadedFileResponse = $this->http->request('POST',
$uploadedFileResponse = $this->httpUser1->request('POST',
"api/v3/forms/{$this->testForms[0]['id']}/submissions/files/{$this->testForms[0]['questions'][2]['id']}",
[
'multipart' => [
Expand All @@ -1380,7 +1392,7 @@ public function testUpdateSubmission() {
$data = $this->OcsResponse2Data($uploadedFileResponse);
$uploadedFileId = $data[0]['uploadedFileId'];

$resp = $this->http->request('PUT', "api/v3/forms/{$this->testForms[0]['id']}/submissions/{$this->testForms[0]['submissions'][0]['id']}", [
$resp = $this->httpUser1->request('PUT', "api/v3/forms/{$this->testForms[0]['id']}/submissions/{$this->testForms[0]['submissions'][0]['id']}", [
'json' => [
'answers' => [
$this->testForms[0]['questions'][0]['id'] => ['ShortAnswer!2'],
Expand Down

0 comments on commit 94c7f4c

Please sign in to comment.