Back to index

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

List of all members.

Public Member Functions

def setUp
def tearDown
def test_file_has_no_chunks
def test_sets_chunks_for_file
def test_appends_chunks_to_empty_list
def test_appends_chunks_to_nonempty_list

Public Attributes

 tempdir
 fs
 repo
 gen

Detailed Description

Definition at line 663 of file repo_tests.py.


Member Function Documentation

Definition at line 665 of file repo_tests.py.

00665 
00666     def setUp(self):
00667         self.tempdir = tempfile.mkdtemp()
00668 
00669         self.fs = obnamlib.LocalFS(self.tempdir)
00670         self.repo = obnamlib.Repository(self.fs, obnamlib.DEFAULT_NODE_SIZE,
00671                                         obnamlib.DEFAULT_UPLOAD_QUEUE_SIZE,
00672                                         obnamlib.DEFAULT_LRU_SIZE, None,
00673                                         obnamlib.IDPATH_DEPTH,
00674                                         obnamlib.IDPATH_BITS,
00675                                         obnamlib.IDPATH_SKIP,
00676                                         time.time, 0, '')
00677         self.repo.lock_root()
00678         self.repo.add_client('client_name')
00679         self.repo.commit_root()
00680         self.repo.lock_client('client_name')
00681         self.gen = self.repo.start_generation()
00682         self.repo.create('/foo', obnamlib.Metadata())

Definition at line 683 of file repo_tests.py.

00683 
00684     def tearDown(self):
00685         shutil.rmtree(self.tempdir)

Definition at line 694 of file repo_tests.py.

00694 
00695     def test_appends_chunks_to_empty_list(self):
00696         self.repo.append_file_chunks('/foo', [1, 2])
00697         chunkids = self.repo.get_file_chunks(self.gen, '/foo')
00698         self.assertEqual(sorted(chunkids), [1, 2])

Definition at line 699 of file repo_tests.py.

00699 
00700     def test_appends_chunks_to_nonempty_list(self):
00701         self.repo.append_file_chunks('/foo', [1, 2])
00702         self.repo.append_file_chunks('/foo', [3, 4])
00703         chunkids = self.repo.get_file_chunks(self.gen, '/foo')
00704         self.assertEqual(sorted(chunkids), [1, 2, 3, 4])
00705 

Definition at line 686 of file repo_tests.py.

00686 
00687     def test_file_has_no_chunks(self):
00688         self.assertEqual(self.repo.get_file_chunks(self.gen, '/foo'), [])

Definition at line 689 of file repo_tests.py.

00689 
00690     def test_sets_chunks_for_file(self):
00691         self.repo.set_file_chunks('/foo', [1, 2])
00692         chunkids = self.repo.get_file_chunks(self.gen, '/foo')
00693         self.assertEqual(sorted(chunkids), [1, 2])


Member Data Documentation

Definition at line 668 of file repo_tests.py.

Definition at line 680 of file repo_tests.py.

Definition at line 669 of file repo_tests.py.

Definition at line 666 of file repo_tests.py.


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