1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00
This commit is contained in:
Eldad Fux 2020-01-18 16:00:15 +02:00
parent 28560c7520
commit 3a68c963fe

View file

@ -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 [];
}
}