From f0abbbceb1b53a650f8f41e6a7c4efeb47d89f57 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 27 Nov 2023 23:36:20 +0100 Subject: [PATCH] fix(tests): Adjust users for test Signed-off-by: Ferdinand Thiessen --- tests/Integration/Api/ApiV2Test.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/Integration/Api/ApiV2Test.php b/tests/Integration/Api/ApiV2Test.php index b6dc23bbc..6d677f3c6 100644 --- a/tests/Integration/Api/ApiV2Test.php +++ b/tests/Integration/Api/ApiV2Test.php @@ -33,6 +33,9 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use Test\TestCase; +/** + * @group DB + */ class ApiV2Test extends TestCase { /** @var GuzzleHttp\Client */ private $http; @@ -53,7 +56,7 @@ private function setTestForms() { 'hash' => 'abcdefg', 'title' => 'Title of a Form', 'description' => 'Just a simple form.', - 'owner_id' => 'test', + 'owner_id' => 'admin', 'access_json' => [ 'permitAllUsers' => false, 'showToAllUsers' => false @@ -197,6 +200,7 @@ private function setTestForms() { */ public function setUp(): void { parent::setUp(); + \OC::$server->getUserManager()->createUser('user1', 'user1'); $this->setTestForms(); $qb = TestCase::$realDatabase->getQueryBuilder(); @@ -292,7 +296,7 @@ public function setUp(): void { // Set up http Client $this->http = new Client([ 'base_uri' => 'http://localhost:8080/ocs/v2.php/apps/forms/', - 'auth' => ['test', 'test'], + 'auth' => ['admin', 'admin'], 'headers' => [ 'OCS-ApiRequest' => 'true', 'Accept' => 'application/json' @@ -458,7 +462,7 @@ public function dataGetNewForm() { // 'hash' => Some random, cannot be checked. 'title' => '', 'description' => '', - 'ownerId' => 'test', + 'ownerId' => 'admin', // 'created' => time() can not be checked exactly 'access' => [ 'permitAllUsers' => false, @@ -514,7 +518,7 @@ public function dataGetFullForm() { 'hash' => 'abcdefg', 'title' => 'Title of a Form', 'description' => 'Just a simple form.', - 'ownerId' => 'test', + 'ownerId' => 'admin', 'created' => 12345, 'access' => [ 'permitAllUsers' => false, @@ -1017,7 +1021,7 @@ public function dataAddShare() { 'expected' => [ // 'formId' => Checked dynamically 'shareType' => 0, - 'shareWith' => 'test', + 'shareWith' => 'admin', 'permissions' => ['submit'], 'displayName' => 'Test Displayname' ] @@ -1034,7 +1038,7 @@ public function testAddShare(array $expected) { 'json' => [ 'formId' => $this->testForms[0]['id'], 'shareType' => 0, - 'shareWith' => 'test', + 'shareWith' => 'admin', 'permissions' => ['submit'] ] ]); @@ -1281,7 +1285,7 @@ public function testDeleteSubmissions(array $submissionsExpected) { public function dataInsertSubmission() { $submissionsExpected = $this->dataGetSubmissions()['getSubmissions']['expected']; $submissionsExpected['submissions'][] = [ - 'userId' => 'test' + 'userId' => 'admin' ]; return [ @@ -1330,7 +1334,7 @@ public function testInsertSubmission(array $submissionsExpected) { unset($data['submissions'][0]['timestamp']); $this->assertEquals([ - 'userId' => 'test', + 'userId' => 'admin', 'userDisplayName' => 'Test Displayname', 'formId' => $this->testForms[0]['id'], 'answers' => [