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

Remove redundant tests

This commit is contained in:
Jake Barnby 2023-08-18 14:14:52 -04:00
parent f18fb13afd
commit e388f1f8e2
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -3135,171 +3135,6 @@ class ProjectsConsoleClientTest extends Scope
return $data;
}
// Domains
/**
* @depends testCreateProject
*/
public function testCreateProjectDomain($data): array
{
$id = $data['projectId'] ?? '';
$response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/domains', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'domain' => 'sub.example.com',
]);
$this->assertEquals(201, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
// $this->assertIsInt($response['body']['updated']);
$this->assertEquals('sub.example.com', $response['body']['domain']);
$this->assertEquals('com', $response['body']['tld']);
$this->assertEquals('example.com', $response['body']['registerable']);
$this->assertEquals(false, $response['body']['verification']);
$data = array_merge($data, ['domainId' => $response['body']['$id']]);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/platforms', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'domain' => '123',
]);
$this->assertEquals(400, $response['headers']['status-code']);
$response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/platforms', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'type' => 'web',
'name' => 'Too Long Hostname',
'hostname' => \str_repeat("bestdomain", 25) . '.com' // 250 + 4 chars total (exactly above limit)
]);
return $data;
}
/**
* @depends testCreateProjectDomain
*/
public function testListProjectDomain($data): array
{
$id = $data['projectId'] ?? '';
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/domains', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(1, $response['body']['total']);
/**
* Test for FAILURE
*/
return $data;
}
/**
* @depends testCreateProjectDomain
*/
public function testGetProjectDomain($data): array
{
$id = $data['projectId'] ?? '';
$domainId = $data['domainId'] ?? '';
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/domains/' . $domainId, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals($domainId, $response['body']['$id']);
// $this->assertIsInt($response['body']['updated']);
$this->assertEquals('sub.example.com', $response['body']['domain']);
$this->assertEquals('com', $response['body']['tld']);
$this->assertEquals('example.com', $response['body']['registerable']);
$this->assertEquals(false, $response['body']['verification']);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/domains/error', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(404, $response['headers']['status-code']);
return $data;
}
/**
* @depends testCreateProjectDomain
*/
public function testUpdateProjectDomain($data): array
{
$id = $data['projectId'] ?? '';
$domainId = $data['domainId'] ?? '';
$response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/domains/' . $domainId . '/verification', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(401, $response['headers']['status-code']);
/**
* Test for FAILURE
*/
return $data;
}
/**
* @depends testCreateProjectDomain
*/
public function testDeleteProjectDomain($data): array
{
$id = $data['projectId'] ?? '';
$domainId = $data['domainId'] ?? '';
$response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $id . '/domains/' . $domainId, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(204, $response['headers']['status-code']);
$this->assertEmpty($response['body']);
$response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/domains/' . $domainId, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(404, $response['headers']['status-code']);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $id . '/domains/error', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(404, $response['headers']['status-code']);
return $data;
}
public function testDeleteProject(): array
{
$data = [];