~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_errors.py

separate out the client medium from the client encoding protocol for the smart server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
            "atree.",
50
50
            str(error))
51
51
 
 
52
    def test_too_many_concurrent_requests(self):
 
53
        error = errors.TooManyConcurrentRequests("a medium")
 
54
        self.assertEqualDiff("The medium 'a medium' has reached its concurrent "
 
55
            "request limit. Be sure to finish_writing and finish_reading on "
 
56
            "the current request that is open.",
 
57
            str(error))
 
58
 
52
59
    def test_up_to_date(self):
53
60
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
54
61
        self.assertEqualDiff("The branch format Bazaar-NG branch, "
64
71
                             repo.bzrdir.root_transport.base,
65
72
                             str(error))
66
73
 
 
74
    def test_reading_completed(self):
 
75
        error = errors.ReadingCompleted("a request")
 
76
        self.assertEqualDiff("The MediumRequest 'a request' has already had "
 
77
            "finish_reading called upon it - the request has been completed and"
 
78
            " no more data may be read.",
 
79
            str(error))
 
80
 
 
81
    def test_writing_completed(self):
 
82
        error = errors.WritingCompleted("a request")
 
83
        self.assertEqualDiff("The MediumRequest 'a request' has already had "
 
84
            "finish_writing called upon it - accept bytes may not be called "
 
85
            "anymore.",
 
86
            str(error))
 
87
 
 
88
    def test_writing_not_completed(self):
 
89
        error = errors.WritingNotComplete("a request")
 
90
        self.assertEqualDiff("The MediumRequest 'a request' has not has "
 
91
            "finish_writing called upon it - until the write phase is complete"
 
92
            " no data may be read.",
 
93
            str(error))
 
94
 
67
95
 
68
96
class PassThroughError(errors.BzrNewError):
69
97
    """Pass through %(foo)s and %(bar)s"""