/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_object_store.py

More work on roundtrip push support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    )
29
29
from bzrlib.graph import (
30
30
    DictParentsProvider,
31
 
    Graph,
32
31
    )
33
32
from bzrlib.tests import (
34
33
    TestCase,
72
71
 
73
72
    def _find_missing(self, ancestry, want, have):
74
73
        return _find_missing_bzr_revids(
75
 
            Graph(DictParentsProvider(ancestry)),
 
74
            DictParentsProvider(ancestry).get_parent_map,
76
75
            set(want), set(have))
77
76
 
78
77
    def test_simple(self):
141
140
    def test_get_blob(self):
142
141
        b = Blob()
143
142
        b.data = 'a\nb\nc\nd\ne\n'
144
 
        self.store.lock_read()
145
 
        self.addCleanup(self.store.unlock)
146
143
        self.assertRaises(KeyError, self.store.__getitem__, b.id)
147
144
        bb = BranchBuilder(branch=self.branch)
148
145
        bb.start_series()
151
148
             ('add', ('foo', 'foo-id', 'file', 'a\nb\nc\nd\ne\n')),
152
149
             ])
153
150
        bb.finish_series()
154
 
        # read locks cache
155
 
        self.assertRaises(KeyError, self.store.__getitem__, b.id)
156
 
        self.store.unlock()
157
 
        self.store.lock_read()
158
151
        self.assertEquals(b, self.store[b.id])
159
152
 
160
153
    def test_get_raw(self):
161
154
        b = Blob()
162
155
        b.data = 'a\nb\nc\nd\ne\n'
163
 
        self.store.lock_read()
164
 
        self.addCleanup(self.store.unlock)
165
156
        self.assertRaises(KeyError, self.store.get_raw, b.id)
166
157
        bb = BranchBuilder(branch=self.branch)
167
158
        bb.start_series()
170
161
             ('add', ('foo', 'foo-id', 'file', 'a\nb\nc\nd\ne\n')),
171
162
             ])
172
163
        bb.finish_series()
173
 
        # read locks cache
174
 
        self.assertRaises(KeyError, self.store.get_raw, b.id)
175
 
        self.store.unlock()
176
 
        self.store.lock_read()
177
164
        self.assertEquals(b.as_raw_string(), self.store.get_raw(b.id)[1])
178
165
 
179
166
    def test_contains(self):
180
167
        b = Blob()
181
168
        b.data = 'a\nb\nc\nd\ne\n'
182
 
        self.store.lock_read()
183
 
        self.addCleanup(self.store.unlock)
184
169
        self.assertFalse(b.id in self.store)
185
170
        bb = BranchBuilder(branch=self.branch)
186
171
        bb.start_series()
189
174
             ('add', ('foo', 'foo-id', 'file', 'a\nb\nc\nd\ne\n')),
190
175
             ])
191
176
        bb.finish_series()
192
 
        # read locks cache
193
 
        self.assertFalse(b.id in self.store)
194
 
        self.store.unlock()
195
 
        self.store.lock_read()
196
177
        self.assertTrue(b.id in self.store)
197
178
 
198
179