From 55c89d47e84ea1d0af67c176fc08688dfb8fe478 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 19 Jan 2020 15:36:30 +0200 Subject: [PATCH] Completed teams service e2e tests --- tests/e2e/Services/Teams/TeamsBaseClient.php | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php index 4c7f14df3..0201ccb33 100644 --- a/tests/e2e/Services/Teams/TeamsBaseClient.php +++ b/tests/e2e/Services/Teams/TeamsBaseClient.php @@ -199,6 +199,41 @@ trait TeamsBaseClient $this->assertEquals(400, $response['headers']['status-code']); + return $data; + } + + /** + * @depends testUpdateTeamMembership + */ + public function testDeleteTeamMembership($data):array + { + $teamUid = (isset($data['teamUid'])) ? $data['teamUid'] : ''; + $inviteUid = (isset($data['inviteUid'])) ? $data['inviteUid'] : ''; + + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_DELETE, '/teams/'.$teamUid.'/memberships/'.$inviteUid, array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$uid'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + $this->assertEmpty($response['body']); + + /** + * Test for FAILURE + */ + $response = $this->client->call(Client::METHOD_GET, '/teams/'.$teamUid.'/memberships/'.$inviteUid, array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$uid'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(1, $response['body']); + return []; } } \ No newline at end of file