~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/revisionstore_implementations/test_all.py

  • Committer: Robert Collins
  • Date: 2006-03-06 07:14:27 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060306071427-359ef15c1d891e84
Add total_size to the revision_store api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        self.transaction = PassThroughTransaction()
41
41
 
42
42
    def test_add_has_get(self):
 
43
        rev = self.add_sample_rev()
 
44
        self.assertTrue(self.store.has_revision_id('A', self.transaction))
 
45
        rev2 = self.store.get_revision('A', self.transaction)
 
46
        self.assertEqual(rev, rev2)
 
47
 
 
48
    def add_sample_rev(self):
43
49
        rev = Revision(timestamp=0,
44
50
                       timezone=None,
45
51
                       committer="Foo Bar <foo@example.com>",
47
53
                       inventory_sha1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
48
54
                       revision_id='A')
49
55
        self.store.add_revision(rev, self.transaction)
50
 
        self.assertTrue(self.store.has_revision_id('A', self.transaction))
51
 
        rev2 = self.store.get_revision('A', self.transaction)
52
 
        self.assertEqual(rev, rev2)
 
56
        return rev
53
57
 
54
58
    def test_has_missing(self):
55
59
        # has of a non present id -> False
73
77
                          'B',
74
78
                          'foo\nbar',
75
79
                          self.transaction)
 
80
 
 
81
    def test_total_size(self):
 
82
        # we get a revision count and a numeric size figure from total_size().
 
83
        count, bytes = self.store.total_size(self.transaction)
 
84
        self.assertEqual(0, count)
 
85
        self.assertEqual(0, bytes)
 
86
        self.add_sample_rev()
 
87
        count, bytes = self.store.total_size(self.transaction)
 
88
        self.assertEqual(1, count)
 
89
        self.assertNotEqual(0, bytes)
 
90