Example #1
0
 def test_validate_error(self):
     field = ChallengeField('md5', name='asdf')
     with pytest.raises(TypeError):
         field._validate(None, 100)
Example #2
0
 def test_validate_str(self):
     field = ChallengeField('md5')
     val = field._validate(None, b'digest')
     assert val.digest == hashlib.md5(val.salt + b'digest').digest()
Example #3
0
 def test_validate_tuple(self):
     val = DigestValue(b'salt', b'digest', hashlib.md5)
     field = ChallengeField('md5')
     assert field._validate(None, val) is val
Example #4
0
 def test_validate_error(self):
     field = ChallengeField('md5', name='asdf')
     with pytest.raises(ValueError):
         field._validate(MockConfig(), 100)