~ubuntu-branches/ubuntu/natty/bzr/natty-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_request.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-08-07 00:54:52 UTC
  • mfrom: (1.4.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100807005452-g4zb99ezl3xn44r4
Tags: 2.2.0-1
* New upstream release.
 + Adds support for setting timestamps to originating revisions.
   Closes: #473450
 + Removes remaining string exception. Closes: #585193, LP: #586926
 + Add C extension to work around Python issue 1628205. LP: #583941,
   Closes: #577110
 + Avoids showing progress bars when --quiet is used. Closes: #542105,
   LP: #320035
 + No longer creates ~/.bazaar as root when run under sudo. LP: #376388
 + 'bzr commit' now supports -p as alternative for --show-diff. LP: #571467
 + 'bzr add' no longer adds .THIS/.BASE/.THEIRS files unless
   explicitly requested. LP: #322767
 + When parsing patch files, Bazaar now supports diff lines before each
   patch. LP: #502076
 + WorkingTrees now no longer requires using signal.signal, so can
   be used in a threaded environment. LP: #521989
 + An assertion error is no longer triggered when pushing to a pre-1.6
   Bazaar server. LP: #528041
* Bump standards version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
import threading
20
20
 
21
 
from bzrlib import errors
 
21
from bzrlib import (
 
22
    errors,
 
23
    transport,
 
24
    )
22
25
from bzrlib.bzrdir import BzrDir
23
26
from bzrlib.smart import request
24
27
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
25
 
from bzrlib.transport import get_transport
26
28
 
27
29
 
28
30
class NoBodyRequest(request.SmartServerRequest):
34
36
 
35
37
class DoErrorRequest(request.SmartServerRequest):
36
38
    """A request that raises an error from self.do()."""
37
 
    
 
39
 
38
40
    def do(self):
39
41
        raise errors.NoSuchFile('xyzzy')
40
42
 
172
174
 
173
175
 
174
176
class TestRequestJail(TestCaseWithMemoryTransport):
175
 
    
 
177
 
176
178
    def test_jail(self):
177
179
        transport = self.get_transport('blah')
178
180
        req = request.SmartServerRequest(transport)
203
205
        # A parent is not allowed
204
206
        self.assertRaises(errors.JailBreak, _pre_open_hook, t.clone('..'))
205
207
        # A completely unrelated transport is not allowed
206
 
        self.assertRaises(
207
 
            errors.JailBreak, _pre_open_hook, get_transport('http://host/'))
 
208
        self.assertRaises(errors.JailBreak, _pre_open_hook,
 
209
                          transport.get_transport('http://host/'))
208
210
 
209
211
    def test_open_bzrdir_in_non_main_thread(self):
210
212
        """Opening a bzrdir in a non-main thread should work ok.