~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2007-02-21 14:46:06 UTC
  • mto: (2326.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2327.
  • Revision ID: v.ladeuil+lp@free.fr-20070221144606-qoy01pue1p187j3b
Provide a better implementation for testing passwords.

* bzrlib/ui/__init__.py:
(UIFactory.get_login): Deleted.
(CLIUIFactory.get_non_echoed_password): New method allowing
overriding.

* bzrlib/tests/__init__.py:
(TestUIFactory.get_non_echoed_password): Allows password testing
 without worrying about echo echo.

* bzrlib/tests/__init__.py:
(TestUIFactory): Moved from bzrlib/tests/blackbox/__init__.py
(FakeStdin): Deleted.
(TestCase.run_bzr_captured): Set and reuse ui.ui_factory.stdin.

* bzrlib/ui/text.py:
(TextUIFactory.get_login): Deleted.
(TextUIFactory.get_password): Moved to CLIUIFactory.

* bzrlib/tests/test_ui.py:
(UITests): Delete get_login tests.
(FakeTextUIFactory): Deleted. Better implementation in
TestUIFactory.

* bzrlib/tests/blackbox/__init__.py:
(TestUIFactory): Moved to bzrlib/tests/__init__.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
            return self.run_bzr_captured(args, retcode=retcode)[0]
119
119
        else:
120
120
            return self.run_bzr_captured(args, retcode=retcode)
121
 
 
122
 
 
123
 
class TestUIFactory(ui.CLIUIFactory):
124
 
    """A UI Factory for testing - hide the progress bar but emit note()s."""
125
 
 
126
 
    def __init__(self,
127
 
                 stdout=None,
128
 
                 stderr=None):
129
 
        super(TestUIFactory, self).__init__()
130
 
        if stdout is None:
131
 
            self.stdout = sys.stdout
132
 
        else:
133
 
            self.stdout = stdout
134
 
        if stderr is None:
135
 
            self.stderr = sys.stderr
136
 
        else:
137
 
            self.stderr = stderr
138
 
 
139
 
    def clear(self):
140
 
        """See progress.ProgressBar.clear()."""
141
 
 
142
 
    def clear_term(self):
143
 
        """See progress.ProgressBar.clear_term()."""
144
 
 
145
 
    def clear_term(self):
146
 
        """See progress.ProgressBar.clear_term()."""
147
 
 
148
 
    def finished(self):
149
 
        """See progress.ProgressBar.finished()."""
150
 
 
151
 
    def note(self, fmt_string, *args, **kwargs):
152
 
        """See progress.ProgressBar.note()."""
153
 
        self.stdout.write((fmt_string + "\n") % args)
154
 
 
155
 
    def progress_bar(self):
156
 
        return self
157
 
    
158
 
    def nested_progress_bar(self):
159
 
        return self
160
 
 
161
 
    def update(self, message, count=None, total=None):
162
 
        """See progress.ProgressBar.update()."""