diff --git a/tests/e2e/Services/Teams/TeamsBase.php b/tests/e2e/Services/Teams/TeamsBase.php index f85c36d21..c6ad92e89 100644 --- a/tests/e2e/Services/Teams/TeamsBase.php +++ b/tests/e2e/Services/Teams/TeamsBase.php @@ -261,4 +261,46 @@ trait TeamsBase return []; } + + public function testCreateTeamMembership():array + { + /** + * Test for SUCCESS + */ + $response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$uid'], + ], $this->getHeaders()), [ + 'name' => 'Demo' + ]); + + $teamUid = $response['body']['$uid']; + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$uid']); + $this->assertEquals('Demo', $response['body']['name']); + $this->assertGreaterThan(-1, $response['body']['sum']); + $this->assertIsInt($response['body']['sum']); + $this->assertIsInt($response['body']['dateCreated']); + + $response = $this->client->call(Client::METHOD_DELETE, '/teams/'.$teamUid, array_merge([ + '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, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$uid'], + ], $this->getHeaders())); + + $this->assertEquals(404, $response['headers']['status-code']); + + return []; + } } \ No newline at end of file