~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Martin Pool
  • Date: 2009-07-22 05:18:23 UTC
  • mto: This revision was merged to the branch mainline in revision 4558.
  • Revision ID: mbp@sourcefrog.net-20090722051823-qv1djgthwt89sb5b
Add basic test for CannedInputUIFactory

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    _TTYStringIO,
42
42
    )
43
43
from bzrlib.ui import (
 
44
    CannedInputUIFactory,
44
45
    CLIUIFactory,
45
46
    SilentUIFactory,
46
47
    UIFactory,
330
331
            NotImplementedError,
331
332
            self.apply_redirected,
332
333
            None, stdout, stdout, factory.get_boolean, "foo")
 
334
 
 
335
 
 
336
class CannedInputUIFactoryTests(TestCase):
 
337
    
 
338
    def test_canned_input_get_input(self):
 
339
        uif = CannedInputUIFactory([True, 'mbp', 'password'])
 
340
        self.assertEqual(uif.get_boolean('Extra cheese?'), True)
 
341
        self.assertEqual(uif.get_username('Enter your user name'), 'mbp')
 
342
        self.assertEqual(uif.get_password('Password for %(host)s', host='example.com'),
 
343
            'password')