#NEWLINE# def test_custom( self ) : #NEWLINE# #INDENT# def _new( val ) : #NEWLINE# #INDENT# conf = config . new ( { #NEWLINE# #INDENT# 'hash' : { #NEWLINE# #INDENT# 'algorithm' : val , #NEWLINE# 'salt' : '' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# return new ( conf . section ( 'hash' ) ) #NEWLINE# #UNINDENT# sha1 = _new ( 'sha1' ) #NEWLINE# self . assertIsInstance ( sha1 , Hash ) #NEWLINE# self . assertEqual ( sha1 . func , 'sha1' ) #NEWLINE# self . assertRaises ( ValueError , _new , 'foo' ) #NEWLINE# pbkdf2 = _new ( 'pbkdf2:16' ) #NEWLINE# self . assertIsInstance ( pbkdf2 , PBKDF2 ) #NEWLINE# self . assertEqual ( pbkdf2 . iterations , 16 ) #NEWLINE# pbkdf2 = _new ( 'pbkdf2:16:2:md5' ) #NEWLINE# self . assertIsInstance ( pbkdf2 , PBKDF2 ) #NEWLINE# self . assertEqual ( pbkdf2 . dklen , 2 ) #NEWLINE# self . assertEqual ( _new . func , 'md5' )