/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Robert Collins
  • Date: 2008-02-13 03:30:01 UTC
  • mfrom: (3221 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3224.
  • Revision ID: robertc@robertcollins.net-20080213033001-rw70ul0zb02ph856
Merge to fix conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    bzrdir,
23
23
    errors,
24
24
    symbol_versioning,
 
25
    urlutils,
25
26
    )
26
27
from bzrlib.tests import TestCase, TestCaseWithTransport
27
28
 
28
29
 
29
 
 
30
30
class TestErrors(TestCaseWithTransport):
31
31
 
32
32
    def test_disabled_method(self):
57
57
            "The transport 'fpp' is only accessible within this process.",
58
58
            str(error))
59
59
 
 
60
    def test_invalid_http_range(self):
 
61
        error = errors.InvalidHttpRange('path',
 
62
                                        'Content-Range: potatoes 0-00/o0oo0',
 
63
                                        'bad range')
 
64
        self.assertEquals("Invalid http range"
 
65
                          " 'Content-Range: potatoes 0-00/o0oo0'"
 
66
                          " for path: bad range",
 
67
                          str(error))
 
68
 
 
69
    def test_invalid_range(self):
 
70
        error = errors.InvalidRange('path', 12, 'bad range')
 
71
        self.assertEquals("Invalid range access in path at 12: bad range",
 
72
                          str(error))
 
73
 
60
74
    def test_inventory_modified(self):
61
75
        error = errors.InventoryModified("a tree to be repred")
62
76
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
86
100
                         '"stream format" into knit of format '
87
101
                         '"target format".', str(error))
88
102
 
 
103
    def test_knit_data_stream_unknown(self):
 
104
        error = errors.KnitDataStreamUnknown(
 
105
            'stream format')
 
106
        self.assertEqual('Cannot parse knit data stream of format '
 
107
                         '"stream format".', str(error))
 
108
 
89
109
    def test_knit_header_error(self):
90
110
        error = errors.KnitHeaderError('line foo\n', 'path/to/file')
91
111
        self.assertEqual("Knit header error: 'line foo\\n' unexpected"
102
122
        error = errors.MediumNotConnected("a medium")
103
123
        self.assertEqualDiff(
104
124
            "The medium 'a medium' is not connected.", str(error))
105
 
        
 
125
 
 
126
    def test_no_public_branch(self):
 
127
        b = self.make_branch('.')
 
128
        error = errors.NoPublicBranch(b)
 
129
        url = urlutils.unescape_for_display(b.base, 'ascii')
 
130
        self.assertEqualDiff(
 
131
            'There is no public branch set for "%s".' % url, str(error))
 
132
 
106
133
    def test_no_repo(self):
107
134
        dir = bzrdir.BzrDir.create(self.get_url())
108
135
        error = errors.NoRepositoryPresent(dir)
390
417
            "you wish to keep, and delete it when you are done.",
391
418
            str(err))
392
419
 
 
420
    def test_unable_create_symlink(self):
 
421
        err = errors.UnableCreateSymlink()
 
422
        self.assertEquals(
 
423
            "Unable to create symlink on this platform",
 
424
            str(err))
 
425
        err = errors.UnableCreateSymlink(path=u'foo')
 
426
        self.assertEquals(
 
427
            "Unable to create symlink 'foo' on this platform",
 
428
            str(err))
 
429
        err = errors.UnableCreateSymlink(path=u'\xb5')
 
430
        self.assertEquals(
 
431
            "Unable to create symlink u'\\xb5' on this platform",
 
432
            str(err))
 
433
 
 
434
    def test_incorrect_url(self):
 
435
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
 
436
        self.assertEquals(
 
437
            ("The URL for bug tracker \"foo\" doesn't contain {id}: "
 
438
             "http://bug.com/"),
 
439
            str(err))
 
440
 
393
441
 
394
442
class PassThroughError(errors.BzrError):
395
443