1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +12:00

chore: add tests

This commit is contained in:
Christy Jacob 2023-04-29 13:13:33 +05:30
parent 8be36088d7
commit 9a712686f2
2 changed files with 34 additions and 3 deletions

View file

@ -6,8 +6,8 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
stopOnFailure="true"
>
<extensions>
<extension class="Appwrite\Tests\TestHook" />
</extensions>

View file

@ -3,6 +3,7 @@
namespace Tests\E2E\Services\Projects;
use Appwrite\Auth\Auth;
use Appwrite\Extend\Exception;
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\ProjectConsole;
use Tests\E2E\Scopes\SideClient;
@ -98,7 +99,37 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(400, $response['headers']['status-code']);
return ['projectId' => $projectId];
return [
'projectId' => $projectId,
'teamId' => $team['body']['$id']
];
}
/**
* @depends testCreateProject
*/
public function testCreateDuplicateProject($data)
{
$teamId = $data['teamId'] ?? '';
$projectId = $data['projectId'] ?? '';
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_POST, '/projects', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'projectId' => $projectId,
'name' => 'Project Duplicate',
'teamId' => $teamId,
'region' => 'default'
]);
$this->assertEquals(403, $response['headers']['status-code']);
$this->assertEquals(403, $response['body']['code']);
$this->assertEquals(Exception::PROJECT_ALREADY_EXISTS, $response['body']['type']);
$this->assertEquals('Project with the requested ID already exists.', $response['body']['message']);
}
/**