wip
This commit is contained in:
parent
28560c7520
commit
3a68c963fe
1 changed files with 42 additions and 0 deletions
|
@ -261,4 +261,46 @@ trait TeamsBase
|
||||||
|
|
||||||
return [];
|
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 [];
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue