<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from dfvfs . lib import definitions <EOL> from dfvfs . path import encrypted_stream_path_spec <EOL> from dfvfs . path import os_path_spec <EOL> from dfvfs . resolver import context <EOL> from dfvfs . resolver import resolver <EOL> from dfvfs . vfs import encrypted_stream_file_system <EOL> class EncryptedStreamFileSystemTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> _RC4_KEY = b'<STR_LIT>' <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _resolver_context = context . Context ( ) <EOL> test_file = os . path . join ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> path_spec = os_path_spec . OSPathSpec ( location = test_file ) <EOL> self . _encrypted_stream_path_spec = ( <EOL> encrypted_stream_path_spec . EncryptedStreamPathSpec ( <EOL> encryption_method = definitions . ENCRYPTION_METHOD_RC4 , <EOL> parent = path_spec ) ) <EOL> resolver . Resolver . key_chain . SetCredential ( <EOL> self . _encrypted_stream_path_spec , u'<STR_LIT:key>' , self . _RC4_KEY ) <EOL> def testOpenAndClose ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = encrypted_stream_file_system . EncryptedStreamFileSystem ( <EOL> self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _encrypted_stream_path_spec ) <EOL> file_system . Close ( ) <EOL> def testFileEntryExistsByPathSpec ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = encrypted_stream_file_system . EncryptedStreamFileSystem ( <EOL> self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _encrypted_stream_path_spec ) <EOL> self . assertTrue ( file_system . FileEntryExistsByPathSpec ( <EOL> self . _encrypted_stream_path_spec ) ) <EOL> file_system . Close ( ) <EOL> def testGetFileEntryByPathSpec ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = encrypted_stream_file_system . EncryptedStreamFileSystem ( <EOL> self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _encrypted_stream_path_spec ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( <EOL> self . _encrypted_stream_path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . name , u'<STR_LIT>' ) <EOL> file_system . Close ( ) <EOL> def testGetRootFileEntry ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = encrypted_stream_file_system . EncryptedStreamFileSystem ( <EOL> self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _encrypted_stream_path_spec ) <EOL> file_entry = file_system . GetRootFileEntry ( ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . name , u'<STR_LIT>' ) <EOL> file_system . Close ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
