27
27
tt = transform.TransformPreview(tree)
28
28
self.addCleanup(tt.finalize)
29
29
tt.new_file(u'foo\u1234', tt.root, 'bar', 'baz', True)
30
tt.new_directory('qux', tt.root, 'quxx')
30
31
output = serialize(tt)
31
32
tt2 = transform.TransformPreview(tree)
32
33
deserialize(tt2, output)
33
self.assertEqual(2, tt2._id_number)
34
self.assertEqual({'new-1': u'foo\u1234'}, tt2._new_name)
35
self.assertEqual({'new-1': 'baz'}, tt2._new_id)
36
self.assertEqual({'new-1': tt.root}, tt2._new_parent)
37
self.assertEqual({'baz': 'new-1'}, tt2._r_new_id)
38
self.assertEqual({'new-1': 'file'}, tt2._new_contents)
34
self.assertEqual(3, tt2._id_number)
35
self.assertEqual({'new-1': u'foo\u1234',
36
'new-2': 'qux'}, tt2._new_name)
37
self.assertEqual({'new-1': 'baz', 'new-2': 'quxx'}, tt2._new_id)
38
self.assertEqual({'new-1': tt.root, 'new-2': tt.root}, tt2._new_parent)
39
self.assertEqual({'baz': 'new-1', 'quxx': 'new-2'}, tt2._r_new_id)
40
self.assertEqual({'new-1': 'file',
41
'new-2': 'directory'}, tt2._new_contents)
39
42
foo_limbo = open(tt2._limbo_name('new-1'), 'rb')
41
44
foo_content = foo_limbo.read()