17
17
"""Revision store tests."""
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
24
class TestAll(TestCaseWithTransport):
24
from bzrlib.transactions import PassThroughTransaction
25
from bzrlib.tree import EmptyTree
28
class TestFactory(TestCaseWithTransport):
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))
35
class TestAll(TestCaseWithTransport):
38
super(TestAll, self).setUp()
39
self.store = self.store_factory.create(self.get_url('.'))
40
self.transaction = PassThroughTransaction()
43
# adding a revision should fail if the inventory is not present.
44
inv = EmptyTree().inventory
45
sha1 = "111111111111111111111111111111111111111"
46
rev = Revision(timestamp=0,
48
committer="Foo Bar <foo@example.com>",
51
revision_id='should_fail')
52
self.assertRaises(errors.InventoryNotPresent,
53
self.store.add_revision,
54
rev, self.transaction)
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))
60
def test_has_None(self):
62
self.assertTrue(self.store.has_revision_id(None, self.transaction))