137
137
def test_parse_versioned_root_only(self):
138
138
deserializer = inventory_delta.InventoryDeltaDeserializer()
139
deserializer.require_flags(versioned_root=True, tree_references=True)
140
139
parse_result = deserializer.parse_text_bytes(root_only_lines)
141
140
expected_entry = inventory.make_entry(
142
141
'directory', u'', None, 'an-id')
177
174
def test_parse_unique_root_id_root_versioned_disabled(self):
178
175
deserializer = inventory_delta.InventoryDeltaDeserializer()
179
deserializer.require_flags(versioned_root=False, tree_references=True)
180
176
root_only_lines = """format: bzr inventory delta v1 (bzr 1.14)
181
177
parent: parent-id
182
178
version: a@e\xc3\xa5ample.com--2004
191
187
def test_parse_unversioned_root_versioning_enabled(self):
192
188
deserializer = inventory_delta.InventoryDeltaDeserializer()
193
deserializer.require_flags(versioned_root=True, tree_references=True)
194
err = self.assertRaises(errors.BzrError,
195
deserializer.parse_text_bytes, root_only_unversioned)
196
self.assertContainsRe(
197
str(err), 'serialized versioned_root flag is wrong: False')
189
parse_result = deserializer.parse_text_bytes(root_only_unversioned)
190
expected_entry = inventory.make_entry(
191
'directory', u'', None, 'TREE_ROOT')
192
expected_entry.revision = 'entry-version'
194
('null:', 'entry-version', False, False,
195
[(None, u'', 'TREE_ROOT', expected_entry)]),
198
def test_parse_versioned_root_when_disabled(self):
199
deserializer = inventory_delta.InventoryDeltaDeserializer(
200
allow_versioned_root=False)
201
err = self.assertRaises(inventory_delta._IncompatibleDelta,
202
deserializer.parse_text_bytes, root_only_lines)
203
self.assertEquals("versioned_root not allowed", str(err))
199
205
def test_parse_tree_when_disabled(self):
200
deserializer = inventory_delta.InventoryDeltaDeserializer()
201
deserializer.require_flags(versioned_root=True, tree_references=False)
202
err = self.assertRaises(errors.BzrError,
206
deserializer = inventory_delta.InventoryDeltaDeserializer(
207
allow_tree_references=False)
208
err = self.assertRaises(inventory_delta._IncompatibleDelta,
203
209
deserializer.parse_text_bytes, reference_lines)
204
self.assertContainsRe(
205
str(err), 'serialized tree_references flag is wrong: True')
210
self.assertEquals("Tree reference not allowed", str(err))
207
212
def test_parse_tree_when_header_disallows(self):
208
213
# A deserializer that allows tree_references to be set or unset.