/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: Lukáš Lalinský
  • Date: 2007-12-17 17:28:25 UTC
  • mfrom: (3120 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3123.
  • Revision ID: lalinsky@gmail.com-20071217172825-tr3pqm1mhvs3gwnn
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.tests import TestCase, TestCaseWithTransport
27
27
 
28
28
 
29
 
 
30
29
class TestErrors(TestCaseWithTransport):
31
30
 
32
31
    def test_disabled_method(self):
57
56
            "The transport 'fpp' is only accessible within this process.",
58
57
            str(error))
59
58
 
 
59
    def test_invalid_http_range(self):
 
60
        error = errors.InvalidHttpRange('path',
 
61
                                        'Content-Range: potatoes 0-00/o0oo0',
 
62
                                        'bad range')
 
63
        self.assertEquals("Invalid http range"
 
64
                          " 'Content-Range: potatoes 0-00/o0oo0'"
 
65
                          " for path: bad range",
 
66
                          str(error))
 
67
 
 
68
    def test_invalid_range(self):
 
69
        error = errors.InvalidRange('path', 12, 'bad range')
 
70
        self.assertEquals("Invalid range access in path at 12: bad range",
 
71
                          str(error))
 
72
 
60
73
    def test_inventory_modified(self):
61
74
        error = errors.InventoryModified("a tree to be repred")
62
75
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
86
99
                         '"stream format" into knit of format '
87
100
                         '"target format".', str(error))
88
101
 
 
102
    def test_knit_data_stream_unknown(self):
 
103
        error = errors.KnitDataStreamUnknown(
 
104
            'stream format')
 
105
        self.assertEqual('Cannot parse knit data stream of format '
 
106
                         '"stream format".', str(error))
 
107
 
89
108
    def test_knit_header_error(self):
90
109
        error = errors.KnitHeaderError('line foo\n', 'path/to/file')
91
110
        self.assertEqual("Knit header error: 'line foo\\n' unexpected"
382
401
        self.assertEqual(
383
402
            "Corrupt or incompatible data stream: my reason", str(e))
384
403
 
 
404
    def test_immortal_pending_deletion_message(self):
 
405
        err = errors.ImmortalPendingDeletion('foo')
 
406
        self.assertEquals(
 
407
            "Unable to delete transform temporary directory foo.  "
 
408
            "Please examine foo to see if it contains any files "
 
409
            "you wish to keep, and delete it when you are done.",
 
410
            str(err))
 
411
 
 
412
    def test_unable_create_symlink(self):
 
413
        err = errors.UnableCreateSymlink()
 
414
        self.assertEquals(
 
415
            "Unable to create symlink on this platform",
 
416
            str(err))
 
417
        err = errors.UnableCreateSymlink(path=u'foo')
 
418
        self.assertEquals(
 
419
            "Unable to create symlink 'foo' on this platform",
 
420
            str(err))
 
421
        err = errors.UnableCreateSymlink(path=u'\xb5')
 
422
        self.assertEquals(
 
423
            "Unable to create symlink u'\\xb5' on this platform",
 
424
            str(err))
 
425
 
 
426
    def test_incorrect_url(self):
 
427
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
 
428
        self.assertEquals(
 
429
            ("The URL for bug tracker \"foo\" doesn't contain {id}: "
 
430
             "http://bug.com/"),
 
431
            str(err))
 
432
 
385
433
 
386
434
class PassThroughError(errors.BzrError):
387
435