Updated tests and delete methods
This commit is contained in:
parent
bce90d68b0
commit
a3b1e97ebf
|
@ -162,6 +162,10 @@ $utopia->delete('/v1/functions/:functionId')
|
|||
throw new Exception('Function not found', 404);
|
||||
}
|
||||
|
||||
if (!$projectDB->deleteDocument($function->getId())) {
|
||||
throw new Exception('Failed to remove function from DB', 500);
|
||||
}
|
||||
|
||||
$response->noContent();
|
||||
}
|
||||
);
|
||||
|
@ -304,6 +308,10 @@ $utopia->delete('/v1/functions/:functionId/tags/:tagId')
|
|||
throw new Exception('Tag not found', 404);
|
||||
}
|
||||
|
||||
if (!$projectDB->deleteDocument($tag->getId())) {
|
||||
throw new Exception('Failed to remove tag from DB', 500);
|
||||
}
|
||||
|
||||
$response->noContent();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -170,4 +170,34 @@ class FunctionsConsoleServerTest extends Scope
|
|||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testUpdate
|
||||
*/
|
||||
public function testDelete($data):array
|
||||
{
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
$function = $this->client->call(Client::METHOD_DELETE, '/functions/'.$data['functionId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(204, $function['headers']['status-code']);
|
||||
$this->assertEmpty($function['body']);
|
||||
|
||||
$function = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(404, $function['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
*/
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -186,6 +186,13 @@ trait StorageBase
|
|||
|
||||
$this->assertEquals(204, $file['headers']['status-code']);
|
||||
$this->assertEmpty($file['body']);
|
||||
|
||||
$file = $this->client->call(Client::METHOD_GET, '/storage/files/' . $data['fileId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(404, $file['headers']['status-code']);
|
||||
|
||||
/**
|
||||
* Test for FAILURE
|
||||
|
|
Loading…
Reference in a new issue