1
0
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:
David Bomba 2019-04-19 18:09:05 +10:00
parent 5b8f56593e
commit 4cf01d7358

View File

@ -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);
}
}