1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

password dictionary test

This commit is contained in:
Damodar Lohani 2022-12-26 10:27:04 +00:00
parent 0760ea90d6
commit 96cf2e6330

View file

@ -0,0 +1,32 @@
<?php
namespace Tests\Unit\Auth\Validator;
use Appwrite\Auth\Validator\PasswordDictionary;
use PHPUnit\Framework\TestCase;
use Utopia\Database\Document;
class PasswordDictionaryTest extends TestCase
{
protected ?PasswordDictionary $object = null;
public function setUp(): void
{
$this->object = new PasswordDictionary(
['password' => true, '123456' => true],
new Document([
'auths' => [
'passwordDictionary' => true
]
])
);
}
public function testValues(): void
{
$this->assertEquals($this->object->isValid('1'), false); // to check parent is being called
$this->assertEquals($this->object->isValid('123456'), false);
$this->assertEquals($this->object->isValid('password'), false);
$this->assertEquals($this->object->isValid('myPasswordIsRight'), true);
}
}