~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_testament.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-17 13:53:36 UTC
  • mfrom: (1939 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1940.
  • Revision ID: john@arbash-meinel.com-20060817135336-100de82962355d3b
[merge] bzr.dev 1939

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import os
22
22
from sha import sha
23
 
import sys
24
23
 
25
24
from bzrlib.tests import TestCaseWithTransport
26
 
from bzrlib.branch import Branch
27
25
from bzrlib.testament import Testament, StrictTestament
28
 
from bzrlib.trace import mutter
29
26
from bzrlib.transform import TreeTransform
30
27
from bzrlib.osutils import has_symlinks
31
28
 
32
29
 
33
 
class TestamentTests(TestCaseWithTransport):
 
30
class TestamentSetup(TestCaseWithTransport):
34
31
 
35
32
    def setUp(self):
36
 
        super(TestamentTests, self).setUp()
 
33
        super(TestamentSetup, self).setUp()
37
34
        self.wt = self.make_branch_and_tree('.')
38
35
        b = self.b = self.wt.branch
39
36
        b.nick = "test branch"
57
54
                 rev_id='test@user-2',
58
55
                 committer='test@user')
59
56
 
 
57
 
 
58
class TestamentTests(TestamentSetup):
 
59
 
60
60
    def test_null_testament(self):
61
61
        """Testament for a revision with no contents."""
62
62
        t = Testament.from_revision(self.b.repository, 'test@user-1')
100
100
        actual_short = t.as_short_text()
101
101
        self.assertEqualDiff(actual_short, REV_2_SHORT_STRICT)
102
102
 
103
 
    def test_testament_command(self):
104
 
        """Testament containing a file and a directory."""
105
 
        out, err = self.run_bzr_captured(['testament', '--long'])
106
 
        self.assertEqualDiff(err, '')
107
 
        self.assertEqualDiff(out, REV_2_TESTAMENT)
108
 
 
109
 
    def test_testament_command_2(self):
110
 
        """Command getting short testament of previous version."""
111
 
        out, err = self.run_bzr_captured(['testament', '-r1'])
112
 
        self.assertEqualDiff(err, '')
113
 
        self.assertEqualDiff(out, REV_1_SHORT)
114
 
 
115
 
    def test_testament_command_3(self):
116
 
        """Command getting short testament of previous version."""
117
 
        out, err = self.run_bzr_captured(['testament', '-r1', '--strict'])
118
 
        self.assertEqualDiff(err, '')
119
 
        self.assertEqualDiff(out, REV_1_SHORT_STRICT)
120
 
 
121
103
    def test_testament_symlinks(self):
122
104
        """Testament containing symlink (where possible)"""
123
105
        if not has_symlinks():
153
135
            timestamp=1129025493,
154
136
            timezone=36000,
155
137
            rev_id='test@user-3',
156
 
            committer='test@user')
 
138
            committer='Erik B\xe5gfors <test@user>',
 
139
            revprops={'uni':u'\xb5'}
 
140
            )
157
141
        t = Testament.from_revision(self.b.repository, 'test@user-3')
158
142
        self.assertEqualDiff(
159
143
            SAMPLE_UNICODE_TESTAMENT.encode('utf-8'), t.as_text())
316
300
SAMPLE_UNICODE_TESTAMENT = u"""\
317
301
bazaar-ng testament version 1
318
302
revision-id: test@user-3
319
 
committer: test@user
 
303
committer: Erik B\xe5gfors <test@user>
320
304
timestamp: 1129025493
321
305
timezone: 36000
322
306
parents:
330
314
properties:
331
315
  branch-nick:
332
316
    test branch
 
317
  uni:
 
318
    \xb5
333
319
"""