7
7
class TestMergeDirective(tests.TestCase):
10
self.assertRaises(errors.NoMergeSource, merge_directive.MergeDirective,
11
'example:', 'sha', 'http://example.com')
12
self.assertRaises(errors.NoMergeSource, merge_directive.MergeDirective,
13
'example:', 'sha', 'http://example.com', patch_type='diff')
14
md = merge_directive.MergeDirective('example:', 'sha',
12
self.assertRaises(errors.NoMergeSource, merge_directive.MergeDirective,
13
'example:', 'sha', time, timezone, 'http://example.com')
14
self.assertRaises(errors.NoMergeSource, merge_directive.MergeDirective,
15
'example:', 'sha', time, timezone, 'http://example.com',
17
md = merge_directive.MergeDirective('example:', 'sha', time, timezone,
15
18
'http://example.com', public_location='http://example.org')
16
19
self.assertRaises(errors.PatchMissing, merge_directive.MergeDirective,
17
'example:', 'sha', 'http://example.com', patch_type='bundle')
18
md = merge_directive.MergeDirective('null:', 'sha',
20
'example:', 'sha', time, timezone, 'http://example.com',
22
md = merge_directive.MergeDirective('null:', 'sha', time, timezone,
19
23
'http://example.com', patch='blah', patch_type='bundle')
20
24
self.assertRaises(errors.PatchMissing, merge_directive.MergeDirective,
21
'example:', 'http://example.com', 'sha',
25
'example:', 'http://example.com', 'sha', time, timezone,
22
26
public_location="http://example.org", patch_type='diff')
23
md = merge_directive.MergeDirective('example:',
24
'sha1', 'http://example.com', public_location="http://example.org",
27
md = merge_directive.MergeDirective('example:', 'sha1', time, timezone,
28
'http://example.com', public_location="http://example.org",
25
29
patch='', patch_type='diff')
27
31
def test_serialization(self):
28
md = merge_directive.MergeDirective('example:', 'sha',
34
md = merge_directive.MergeDirective('example:', 'sha', time, timezone,
29
35
'http://example.com', public_location="http://example.org",
30
36
patch='booga', patch_type='diff')
31
37
md2 = merge_directive.MergeDirective.from_lines(md.to_lines())
33
39
self.assertEqual('sha', md2.testament_sha1)
34
40
self.assertEqual('http://example.com', md2.submit_location)
35
41
self.assertEqual('http://example.org', md2.public_location)
42
self.assertEqual(time, md2.time)
43
self.assertEqual(timezone, md2.timezone)
36
44
self.assertEqual('diff', md2.patch_type)
37
45
self.assertEqual('booga', md2.patch)
38
46
md.patch = "# Bazaar revision bundle v0.9\n#\n"