Update tests

This commit is contained in:
Jake Barnby
2024-10-22 14:35:11 +13:00
parent 8ab1600417
commit 0a22292d1b
2 changed files with 45 additions and 0 deletions
@@ -2695,4 +2695,48 @@ class AccountCustomClientTest extends Scope
return $data;
}
public function testCreatePushTarget(): void
{
$response = $this->client->call(Client::METHOD_POST, '/account/push/targets', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
], [
'targetId' => ID::unique(),
'identifier' => 'test-identifier',
]);
$this->assertEquals(201, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals('test-identifier', $response['body']['identifier']);
}
public function testUpdatePushTarget(): void
{
$response = $this->client->call(Client::METHOD_POST, '/account/push/targets', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
], [
'targetId' => ID::unique(),
'identifier' => 'test-identifier',
]);
$this->assertEquals(201, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals('test-identifier', $response['body']['identifier']);
$response = $this->client->call(Client::METHOD_PATCH, '/account/push/targets/' . $response['body']['$id'], [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
], [
'identifier' => 'test-identifier-updated',
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('test-identifier-updated', $response['body']['identifier']);
$this->assertEquals(false, $response['body']['expired']);
}
}
+1
View File
@@ -1498,6 +1498,7 @@ trait UsersBase
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('random-email1@mail.org', $response['body']['identifier']);
$this->assertEquals(false, $response['body']['expired']);
return $response['body'];
}