1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Added test webhook

This commit is contained in:
Eldad Fux 2020-11-20 23:03:14 +02:00
parent 7a444d5a24
commit 53e2f2fcc1
2 changed files with 8 additions and 14 deletions

View file

@ -85,10 +85,12 @@ trait ProjectCustom
$this->assertNotEmpty($key['body']);
$this->assertNotEmpty($key['body']['secret']);
$webhook = $this->client->call(Client::METHOD_POST, '/projects/'.$project['body']['$id'].'/webhooks', array_merge([
$webhook = $this->client->call(Client::METHOD_POST, '/projects/'.$project['body']['$id'].'/webhooks', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'cookie' => 'a_session_console=' . $this->getRoot()['session'],
'x-appwrite-project' => 'console',
], [
'name' => 'Webhook Test',
'events' => [
'account.create',
@ -98,6 +100,8 @@ trait ProjectCustom
'account.update.prefs',
'account.recovery.create',
'account.recovery.update',
'account.verification.create',
'account.verification.update',
'account.delete',
'account.sessions.create',
'account.sessions.delete',
@ -123,16 +127,6 @@ trait ProjectCustom
$this->assertEquals(201, $webhook['headers']['status-code']);
$this->assertNotEmpty($webhook['body']);
$this->assertNotEmpty($webhook['body']['secret']);
// return [
// 'email' => $this->demoEmail,
// 'password' => $this->demoPassword,
// 'session' => $session,
// 'projectUid' => $project['body']['$id'],
// 'projectAPIKeySecret' => $key['body']['secret'],
// 'projectSession' => $this->client->parseCookie($user['headers']['set-cookie'])['a_session_' . $project['body']['$id']],
// ];
self::$project = [
'$id' => $project['body']['$id'],

View file

@ -46,7 +46,7 @@ abstract class Scope extends TestCase
protected function getLastRequest():array
{
sleep(10);
sleep(5);
$resquest = json_decode(file_get_contents('http://request-catcher:5000/__last_request__'), true);
$resquest['data'] = json_decode($resquest['data'], true);