1
# Copyright (C) 2005 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as published by
5
# the Free Software Foundation.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
"""UI tests for the test framework."""
19
from bzrlib.tests import (
26
class TestOptions(TestCase):
30
def test_transport_set_to_sftp(self):
31
# test the --transport option has taken effect from within the
33
import bzrlib.transport.sftp
34
if TestOptions.current_test != "test_transport_set_to_sftp":
36
self.assertEqual(bzrlib.transport.sftp.SFTPAbsoluteServer,
37
bzrlib.tests.default_transport)
39
def test_transport(self):
40
# test that --transport=sftp works
41
# FIXME RBC 20060123 this should raise TestSkipped if sftp is not
43
old_transport = bzrlib.tests.default_transport
44
old_root = TestCaseInTempDir.TEST_ROOT
45
TestCaseInTempDir.TEST_ROOT = None
47
TestOptions.current_test = "test_transport_set_to_sftp"
48
stdout = self.capture('selftest --transport=sftp test_transport_set_to_sftp')
49
self.assertContainsRe(stdout, 'Ran 1 test')
50
self.assertEqual(old_transport, bzrlib.tests.default_transport)
52
bzrlib.tests.default_transport = old_transport
53
TestOptions.current_test = None
54
TestCaseInTempDir.TEST_ROOT = old_root