<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from dfvfs . path import os_path_spec <EOL> from dfvfs . path import qcow_path_spec <EOL> from dfvfs . path import vshadow_path_spec <EOL> from dfvfs . resolver import context <EOL> from dfvfs . vfs import vshadow_file_system <EOL> class VShadowFileSystemTest ( unittest . TestCase ) : <EOL> """<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 . _qcow_path_spec = qcow_path_spec . QCOWPathSpec ( parent = path_spec ) <EOL> self . _vshadow_path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT:/>' , parent = self . _qcow_path_spec ) <EOL> def testOpenAndClose ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = vshadow_file_system . VShadowFileSystem ( self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _vshadow_path_spec ) <EOL> file_system . Close ( ) <EOL> def testFileEntryExistsByPathSpec ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = vshadow_file_system . VShadowFileSystem ( self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _vshadow_path_spec ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT:/>' , parent = self . _qcow_path_spec ) <EOL> self . assertTrue ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> parent = self . _qcow_path_spec , store_index = <NUM_LIT:1> ) <EOL> self . assertTrue ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> self . assertTrue ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> parent = self . _qcow_path_spec , store_index = <NUM_LIT:9> ) <EOL> self . assertFalse ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> self . assertFalse ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> self . assertFalse ( file_system . FileEntryExistsByPathSpec ( path_spec ) ) <EOL> file_system . Close ( ) <EOL> def testGetFileEntryByPathSpec ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = vshadow_file_system . VShadowFileSystem ( self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _vshadow_path_spec ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT:/>' , parent = self . _qcow_path_spec ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . name , u'<STR_LIT>' ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> parent = self . _qcow_path_spec , store_index = <NUM_LIT:1> ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . name , u'<STR_LIT>' ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . name , u'<STR_LIT>' ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> parent = self . _qcow_path_spec , store_index = <NUM_LIT:9> ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNone ( file_entry ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNone ( file_entry ) <EOL> path_spec = vshadow_path_spec . VShadowPathSpec ( <EOL> location = u'<STR_LIT>' , parent = self . _qcow_path_spec ) <EOL> file_entry = file_system . GetFileEntryByPathSpec ( path_spec ) <EOL> self . assertIsNone ( file_entry ) <EOL> file_system . Close ( ) <EOL> def testGetRootFileEntry ( self ) : <EOL> """<STR_LIT>""" <EOL> file_system = vshadow_file_system . VShadowFileSystem ( self . _resolver_context ) <EOL> self . assertIsNotNone ( file_system ) <EOL> file_system . Open ( self . _vshadow_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>
