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 as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
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.
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
17
"""Tests for the bzrlib ui
23
from bzrlib.tests import TestCase
24
from bzrlib.ui import SilentUIFactory
25
from bzrlib.ui.text import TextUIFactory
27
class UITests(TestCase):
29
def test_silent_factory(self):
31
ui = SilentUIFactory()
32
pb = ui.progress_bar()
33
# TODO: Test that there is no output from SilentUIFactory
35
self.assertEquals(ui.get_password(), None)
36
self.assertEquals(ui.get_password(u'Hello There \u1234 %(user)s',
40
def test_text_factory(self):
42
pb = ui.progress_bar()
43
# TODO: Test the output from TextUIFactory, perhaps by overriding sys.stdout
45
# Unfortunately we can't actually test the ui.get_password() because
46
# that would actually prompt the user for a password during the test suite
47
# This has been tested manually with both LANG=en_US.utf-8 and LANG=C
49
# self.assertEquals(ui.get_password(u"%(user)s please type 'bogus'",