Skip to content

Commit

Permalink
Adds tests for more login scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
artstorm committed Jul 26, 2015
1 parent d00cb81 commit 887b121
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions api/tests/integration/AuthTest.php
Expand Up @@ -55,6 +55,36 @@ public function testFailedLogin()
$this->assertContains('failed', $body->message);
}

public function testLoginEmptyPassword()
{
$user = factory(App\Models\User::class)->create();
$credential = factory(App\Models\UserCredential::class)->make();
$credential->user_id = $user->user_id;
$credential->save();
$this->get('/auth/jwt/login', [
'PHP_AUTH_USER' => $user->email,
'PHP_AUTH_PW' => '',
]);

$body = json_decode($this->response->getContent());
$this->assertResponseStatus(401);
$this->assertContains('failed', $body->message);
}

public function testLoginUserMissCredentials()
{
$user = factory(App\Models\User::class)->create();

$this->get('/auth/jwt/login', [
'PHP_AUTH_USER' => $user->email,
'PHP_AUTH_PW' => '',
]);

$body = json_decode($this->response->getContent());
$this->assertResponseStatus(401);
$this->assertContains('failed', $body->message);
}

public function testFailedTokenEncoding()
{
$user = factory(App\Models\User::class)->create();
Expand Down

0 comments on commit 887b121

Please sign in to comment.