mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
Add ability to specify auth tokens when creating new users
This commit is contained in:
@@ -65,6 +65,34 @@ class ApiTest extends TestCase
|
||||
$this->assertSame([], $users[0]->sites);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_specify_tokens_when_creating_a_user()
|
||||
{
|
||||
/** @var Response $response */
|
||||
$this->await($this->browser->post('http://127.0.0.1:8080/api/users', [
|
||||
'Host' => 'expose.localhost',
|
||||
'Authorization' => base64_encode('username:secret'),
|
||||
'Content-Type' => 'application/json',
|
||||
], json_encode([
|
||||
'name' => 'Marcel',
|
||||
'token' => 'this-is-my-token'
|
||||
])));
|
||||
|
||||
/** @var Response $response */
|
||||
$response = $this->await($this->browser->get('http://127.0.0.1:8080/api/users', [
|
||||
'Host' => 'expose.localhost',
|
||||
'Authorization' => base64_encode('username:secret'),
|
||||
'Content-Type' => 'application/json',
|
||||
]));
|
||||
|
||||
$body = json_decode($response->getBody()->getContents());
|
||||
$users = $body->paginated->users;
|
||||
|
||||
$this->assertCount(1, $users);
|
||||
$this->assertSame('Marcel', $users[0]->name);
|
||||
$this->assertSame('this-is-my-token', $users[0]->auth_token);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_does_not_allow_domain_reservation_for_users_without_the_right_flag()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user