~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-03 03:09:07 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303030907-6af33664f8791e78
Move responsibility for repository.has_revision into RevisionStore

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Revision store tests."""
18
18
 
19
19
 
 
20
import bzrlib.errors as errors
 
21
from bzrlib.revision import Revision
20
22
from bzrlib.store.revision import RevisionStore
21
23
from bzrlib.tests import TestCaseWithTransport
22
 
 
23
 
 
24
 
class TestAll(TestCaseWithTransport):
 
24
from bzrlib.transactions import PassThroughTransaction
 
25
from bzrlib.tree import EmptyTree
 
26
 
 
27
 
 
28
class TestFactory(TestCaseWithTransport):
25
29
 
26
30
    def test_factory_keeps_smoke_in(self):
27
31
        s = self.store_factory.create(self.get_url('.'))
28
32
        self.assertTrue(isinstance(s, RevisionStore))
 
33
 
 
34
 
 
35
class TestAll(TestCaseWithTransport):
 
36
 
 
37
    def setUp(self):
 
38
        super(TestAll, self).setUp()
 
39
        self.store = self.store_factory.create(self.get_url('.'))
 
40
        self.transaction = PassThroughTransaction()
 
41
 
 
42
    def test_add(self):
 
43
        # adding a revision should fail if the inventory is not present.
 
44
        inv = EmptyTree().inventory
 
45
        sha1 = "111111111111111111111111111111111111111"
 
46
        rev = Revision(timestamp=0,
 
47
                       timezone=None,
 
48
                       committer="Foo Bar <foo@example.com>",
 
49
                       message="Message",
 
50
                       inventory_sha1=sha1,
 
51
                       revision_id='should_fail')
 
52
        self.assertRaises(errors.InventoryNotPresent,
 
53
                          self.store.add_revision,
 
54
                          rev, self.transaction)
 
55
 
 
56
    def test_has_missing(self):
 
57
        # has of a non present id -> False
 
58
        self.assertFalse(self.store.has_revision_id('missing', self.transaction))
 
59
 
 
60
    def test_has_None(self):
 
61
        # has of None -> True
 
62
        self.assertTrue(self.store.has_revision_id(None, self.transaction))