@ -330,23 +330,34 @@ class TestRandomPassword(unittest.TestCase):
class TestParseContent ( unittest . TestCase ) :
def test_empty_password_file ( self ) :
plaintext_password , salt = password . _parse_content ( u ' ' )
plaintext_password , salt , ident = password . _parse_content ( u ' ' )
self . assertEqual ( plaintext_password , u ' ' )
self . assertEqual ( salt , None )
self . assertEqual ( ident , None )
def test ( self ) :
expected_content = u ' 12345678 '
file_content = expected_content
plaintext_password , salt = password . _parse_content ( file_content )
plaintext_password , salt , ident = password . _parse_content ( file_content )
self . assertEqual ( plaintext_password , expected_content )
self . assertEqual ( salt , None )
self . assertEqual ( ident , None )
def test_with_salt ( self ) :
expected_content = u ' 12345678 salt=87654321 '
file_content = expected_content
plaintext_password , salt = password . _parse_content ( file_content )
plaintext_password , salt , ident = password . _parse_content ( file_content )
self . assertEqual ( plaintext_password , u ' 12345678 ' )
self . assertEqual ( salt , u ' 87654321 ' )
self . assertEqual ( ident , None )
def test_with_salt_and_ident ( self ) :
expected_content = u ' 12345678 salt=87654321 ident=2a '
file_content = expected_content
plaintext_password , salt , ident = password . _parse_content ( file_content )
self . assertEqual ( plaintext_password , u ' 12345678 ' )
self . assertEqual ( salt , u ' 87654321 ' )
self . assertEqual ( ident , u ' 2a ' )
class TestFormatContent ( unittest . TestCase ) :