/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_smart_request.py

  • Committer: Andrew Bennetts
  • Date: 2009-02-11 09:45:27 UTC
  • mto: This revision was merged to the branch mainline in revision 4002.
  • Revision ID: andrew.bennetts@canonical.com-20090211094527-pdtj25e4748c2h67
Fix the do_body NotImplementedError log spam.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
"""Tests for smart server request infrastructure (bzrlib.smart.request)."""
 
18
 
 
19
from bzrlib.smart import request
 
20
from bzrlib.tests import TestCase
 
21
 
 
22
 
 
23
class TestSmartRequest(TestCase):
 
24
 
 
25
    def test_request_class_without_do_body(self):
 
26
        """If a request has no body data, and the request's implementation does
 
27
        not override do_body, then no exception is raised.
 
28
        """
 
29
        # Create a SmartServerRequestHandler with a SmartServerRequest subclass
 
30
        # that does not implement do_body.
 
31
        class NoBodyRequest(request.SmartServerRequest):
 
32
            """A request that does not implement do_body."""
 
33
            def do(self):
 
34
                return request.SuccessfulSmartServerResponse(('ok',))
 
35
        handler = request.SmartServerRequestHandler(
 
36
            None, {'foo': NoBodyRequest}, '/')
 
37
        # Emulate a request with no body (i.e. just args).
 
38
        handler.args_received(('foo',))
 
39
        handler.end_received()
 
40
        # no exception was raised.
 
41