Skip to content

Commit

Permalink
fixup! enh(API): add OCS API to create rows
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzz committed Jun 24, 2024
1 parent 53efda0 commit e69e065
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});

Expand Down Expand Up @@ -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());
Expand All @@ -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
*
Expand Down

0 comments on commit e69e065

Please sign in to comment.