mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
tests for login
This commit is contained in:
parent
5b8f56593e
commit
4cf01d7358
@ -125,4 +125,36 @@ class LoginTest extends TestCase
|
||||
$this->assertGuest();
|
||||
}
|
||||
|
||||
public function testApiLogin()
|
||||
{
|
||||
$account = factory(Account::class)->create();
|
||||
$user = factory(User::class)->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'test@example.com',
|
||||
'password' => '123456'
|
||||
]);
|
||||
|
||||
$company = factory(\App\Models\Company::class)->make([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$user->companies()->attach($company->id, [
|
||||
'account_id' => $account->id,
|
||||
'is_owner' => 1,
|
||||
'is_admin' => 1,
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'email' => 'test@example.com',
|
||||
'password' => '123456'
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
])->post('/api/v1/login', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user