Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.repo_tests.RepositoryWalkTests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_walk_find_everything
def test_walk_find_depth_first

Public Attributes

 tempdir
 fs
 repo
 dir_meta
 file_meta
 gen

Detailed Description

Definition at line 764 of file repo_tests.py.


Member Function Documentation

Definition at line 766 of file repo_tests.py.

00766 
00767     def setUp(self):
00768         self.tempdir = tempfile.mkdtemp()
00769 
00770         self.fs = obnamlib.LocalFS(self.tempdir)
00771         self.repo = obnamlib.Repository(self.fs, obnamlib.DEFAULT_NODE_SIZE,
00772                                         obnamlib.DEFAULT_UPLOAD_QUEUE_SIZE,
00773                                         obnamlib.DEFAULT_LRU_SIZE, None,
00774                                         obnamlib.IDPATH_DEPTH,
00775                                         obnamlib.IDPATH_BITS,
00776                                         obnamlib.IDPATH_SKIP,
00777                                         time.time, 0, '')
00778         self.repo.lock_root()
00779         self.repo.add_client('client_name')
00780         self.repo.commit_root()
00781 
00782         self.dir_meta = obnamlib.Metadata()
00783         self.dir_meta.st_mode = stat.S_IFDIR | 0777
00784         
00785         self.file_meta = obnamlib.Metadata()
00786         self.file_meta.st_mode = stat.S_IFREG | 0644
00787         
00788         self.repo.lock_client('client_name')
00789         self.repo.lock_shared()
00790         self.gen = self.repo.start_generation()
00791         
00792         self.repo.create('/', self.dir_meta)
00793         self.repo.create('/foo', self.dir_meta)
00794         self.repo.create('/foo/bar', self.file_meta)
00795         
00796         self.repo.commit_client()
00797         self.repo.open_client('client_name')

Definition at line 798 of file repo_tests.py.

00798 
00799     def tearDown(self):
00800         shutil.rmtree(self.tempdir)

Definition at line 808 of file repo_tests.py.

00808 
00809     def test_walk_find_depth_first(self):
00810         found = list(self.repo.walk(self.gen, '/', depth_first=True))
00811         self.assertEqual(found,
00812                          [('/foo/bar', self.file_meta),
00813                           ('/foo', self.dir_meta),
00814                           ('/', self.dir_meta)])
00815 

Definition at line 801 of file repo_tests.py.

00801 
00802     def test_walk_find_everything(self):
00803         found = list(self.repo.walk(self.gen, '/'))
00804         self.assertEqual(found,
00805                          [('/', self.dir_meta),
00806                           ('/foo', self.dir_meta),
00807                           ('/foo/bar', self.file_meta)])


Member Data Documentation

Definition at line 781 of file repo_tests.py.

Definition at line 784 of file repo_tests.py.

Definition at line 769 of file repo_tests.py.

Definition at line 789 of file repo_tests.py.

Definition at line 770 of file repo_tests.py.

Definition at line 767 of file repo_tests.py.


The documentation for this class was generated from the following file: