From e69e065aefd95478c3b2c54977ed1b075e171d31 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 24 Jun 2024 16:18:13 +0200 Subject: [PATCH] fixup! enh(API): add OCS API to create rows --- .../features/bootstrap/FeatureContext.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 80254b8e4..f98e86dfd 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -681,7 +681,7 @@ public function createView(string $user, string $title, string $tableName, strin $this->viewIds[$viewName] = $newItem['id']; $this->collectionManager->register($newItem, 'view', $newItem['id'], $viewName, function () use ($user, $viewName) { - $this->deleteView($user, $viewName); + $this->deleteViewWithoutAssertion($user, $viewName); unset($this->viewIds[$viewName]); }); @@ -848,12 +848,10 @@ public function updateView(string $user, string $viewName, string $title, ?strin * @param string $viewName */ public function deleteView(string $user, string $viewName): void { - $this->setCurrentUser($user); - - $this->sendRequest( - 'DELETE', - '/apps/tables/api/1/views/'.$this->viewIds[$viewName] - ); + if (!$this->deleteViewWithoutAssertion($user, $viewName)) { + // deletion was not triggered + Assert::assertTrue(isset($this->viewIds[$viewName])); + } $deletedItem = $this->getDataFromResponse($this->response); Assert::assertEquals(200, $this->response->getStatusCode()); @@ -867,6 +865,19 @@ public function deleteView(string $user, string $viewName): void { unset($this->viewIds[$viewName]); } + public function deleteViewWithoutAssertion(string $user, string $viewName): bool { + if (!isset($this->viewIds[$viewName])) { + return false; + } + $this->setCurrentUser($user); + + $this->sendRequest( + 'DELETE', + '/apps/tables/api/1/views/'.$this->viewIds[$viewName] + ); + return true; + } + /** * @Then user :user deletes table with keyword :keyword *