Beispiel #1
0
def test_generate_password_hash_default():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '******'
    password_hash = generate_password_hash(password, digestmod='sha1', salt_length=8)

    assert password_hash.startswith('sha1')
    assert len(password_hash.split('$')[1]) == 8
    assert len(password_hash.split('$')[2]) == 40
    assert check_password_hash(password, password_hash)
Beispiel #2
0
def test_generate_password_hash_sha256():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '******'
    password_hash = generate_password_hash(password, digestmod='sha256', salt_length=20)

    assert password_hash.startswith('sha256')
    assert len(password_hash.split('$')[1]) == 20
    assert len(password_hash.split('$')[2]) == 64
    assert check_password_hash(password, password_hash)
Beispiel #3
0
def test_generate_password_hash_sha256():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '******'
    password_hash = generate_password_hash(password, digestmod='sha256', salt_length=20)

    assert password_hash.startswith('sha256')
    assert len(password_hash.split('$')[1]) == 20
    assert len(password_hash.split('$')[2]) == 64
    assert check_password_hash(password, password_hash)
Beispiel #4
0
def test_generate_password_hash_default():
    from muffin.utils import generate_password_hash, check_password_hash

    password = '******'
    password_hash = generate_password_hash(password, digestmod='sha1', salt_length=8)

    assert password_hash.startswith('sha1')
    assert len(password_hash.split('$')[1]) == 8
    assert len(password_hash.split('$')[2]) == 40
    assert check_password_hash(password, password_hash)
 def check_password(self, raw_password):
     return check_password_hash(raw_password, self.password)
Beispiel #6
0
 def check_password(self, password):
     return check_password_hash(password, self.password)
Beispiel #7
0
 def check_password(self, password):
     """Check password for operator."""
     return check_password_hash(password, self.password)