~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testtestament.py

- add and test 'testament' builtin command

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        t = Testament.from_revision(self.b, 'test@user-2')
83
83
        text_form = t.as_text()
84
84
        self.log('testament text form:\n' + text_form)
85
 
        expect = """\
 
85
        self.assertEqualDiff(text_form, REV_2_TESTAMENT)
 
86
        actual_short = t.as_short_text()
 
87
        self.assertEqualDiff(actual_short, """\
 
88
bazaar-ng testament short form 1
 
89
revision test@user-2
 
90
sha1 %s
 
91
""" % sha(REV_2_TESTAMENT).hexdigest())
 
92
 
 
93
    def test_testament_command(self):
 
94
        """Testament containing a file and a directory."""
 
95
        out, err = self.run_bzr_captured(['testament', '--long'])
 
96
        self.assertEqualDiff(err, '')
 
97
        self.assertEqualDiff(out, REV_2_TESTAMENT)
 
98
 
 
99
 
 
100
REV_2_TESTAMENT = """\
86
101
bazaar-ng testament version 1
87
102
revision-id: test@user-2
88
103
committer: test@user
97
112
  directory src src-id
98
113
  file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
99
114
"""
100
 
        self.assertEqualDiff(text_form, expect)
101
 
        actual_short = t.as_short_text()
102
 
        self.assertEqualDiff(actual_short, """\
103
 
bazaar-ng testament short form 1
104
 
revision test@user-2
105
 
sha1 %s
106
 
""" % sha(expect).hexdigest())