Merge branch 'develop' into v2

This commit is contained in:
Matthew Penner 2021-08-21 12:50:51 -06:00
commit b26556e201
No known key found for this signature in database
GPG key ID: 5396CC4C3C1C9704
12 changed files with 59 additions and 51 deletions

View file

@ -2,10 +2,9 @@
namespace Pterodactyl\Tests\Integration\Api\Client;
use Mockery;
use Pterodactyl\Models\User;
use Illuminate\Http\Response;
use Illuminate\Auth\AuthManager;
use Illuminate\Support\Facades\Hash;
class AccountControllerTest extends ClientApiIntegrationTestCase
{
@ -104,10 +103,7 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
/** @var \Pterodactyl\Models\User $user */
$user = User::factory()->create();
$mock = Mockery::mock(AuthManager::class);
$mock->expects('logoutOtherDevices')->with('New_Password1');
$this->app->instance(AuthManager::class, $mock);
$initialHash = $user->password;
$response = $this->actingAs($user)->putJson('/api/client/account/password', [
'current_password' => 'password',
@ -115,6 +111,12 @@ class AccountControllerTest extends ClientApiIntegrationTestCase
'password_confirmation' => 'New_Password1',
]);
$user = $user->refresh();
$this->assertNotEquals($user->password, $initialHash);
$this->assertTrue(Hash::check('New_Password1', $user->password));
$this->assertFalse(Hash::check('password', $user->password));
$response->assertStatus(Response::HTTP_NO_CONTENT);
}