~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
class TestErrors(TestCaseWithTransport):
32
32
 
 
33
    def test_disabled_method(self):
 
34
        error = errors.DisabledMethod("class name")
 
35
        self.assertEqualDiff(
 
36
            "The smart server method 'class name' is disabled.", str(error))
 
37
 
33
38
    def test_duplicate_file_id(self):
34
39
        error = errors.DuplicateFileId('a_file_id', 'foo')
35
40
        self.assertEqualDiff('File id {a_file_id} already exists in inventory'
36
41
                             ' as foo', str(error))
37
42
 
 
43
    def test_duplicate_help_prefix(self):
 
44
        error = errors.DuplicateHelpPrefix('foo')
 
45
        self.assertEqualDiff('The prefix foo is in the help search path twice.',
 
46
            str(error))
 
47
 
38
48
    def test_inventory_modified(self):
39
49
        error = errors.InventoryModified("a tree to be repred")
40
50
        self.assertEqualDiff("The current inventory for the tree 'a tree to "
86
96
            "smart protocol.",
87
97
            str(error))
88
98
 
 
99
    def test_no_help_topic(self):
 
100
        error = errors.NoHelpTopic("topic")
 
101
        self.assertEqualDiff("No help could be found for 'topic'. "
 
102
            "Please use 'bzr help topics' to obtain a list of topics.",
 
103
            str(error))
 
104
 
89
105
    def test_no_such_id(self):
90
106
        error = errors.NoSuchId("atree", "anid")
91
107
        self.assertEqualDiff("The file id anid is not present in the tree "
105
121
            "to be.",
106
122
            str(error))
107
123
 
 
124
    def test_read_only_lock_error(self):
 
125
        error = errors.ReadOnlyLockError('filename', 'error message')
 
126
        self.assertEqualDiff("Cannot acquire write lock on filename."
 
127
                             " error message", str(error))
 
128
 
108
129
    def test_too_many_concurrent_requests(self):
109
130
        error = errors.TooManyConcurrentRequests("a medium")
110
131
        self.assertEqualDiff("The medium 'a medium' has reached its concurrent "
111
132
            "request limit. Be sure to finish_writing and finish_reading on "
112
 
            "the current request that is open.",
 
133
            "the currently open request.",
113
134
            str(error))
114
135
 
115
136
    def test_unknown_hook(self):
223
244
            host='ahost', port=444, msg='Unable to connect to ssh host',
224
245
            orig_error='my_error')
225
246
 
 
247
    def test_unexpected_smart_server_response(self):
 
248
        e = errors.UnexpectedSmartServerResponse(('not yes',))
 
249
        self.assertEqual(
 
250
            "Could not understand response from smart server: ('not yes',)",
 
251
            str(e))
226
252
 
227
253
 
228
254
class PassThroughError(errors.BzrError):