~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Vincent Ladeuil
  • Date: 2007-04-26 07:21:24 UTC
  • mto: (2420.1.21 bzr.http.auth)
  • mto: This revision was merged to the branch mainline in revision 2463.
  • Revision ID: v.ladeuil+lp@free.fr-20070426072124-bty9pn2i122u1zpx
Fix test failure on pqm.

* bzrlib/tests/test_http.py:
(TestAuth.setUp): Overrides sys.stdout, TestUIFactory will not do
it for us and the tests fail on pqm otherwise.
(TestAuth.test_prompt_for_password): No need to provide stdout
parameter anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import os
25
25
import select
26
26
import socket
 
27
import sys
27
28
import threading
28
29
 
29
30
import bzrlib
1154
1155
        self.build_tree_contents([('a', 'contents of a\n'),
1155
1156
                                  ('b', 'contents of b\n'),])
1156
1157
        self.old_factory = ui.ui_factory
 
1158
        self.old_stdout = sys.stdout
 
1159
        sys.stdout = StringIOWrapper()
1157
1160
        self.addCleanup(self.restoreUIFactory)
1158
1161
 
1159
1162
    def restoreUIFactory(self):
1160
1163
        ui.ui_factory = self.old_factory
 
1164
        sys.stdout = self.old_stdout
1161
1165
 
1162
1166
    def get_user_url(self, user=None, password=None):
1163
1167
        """Build an url embedding user and password"""
1211
1215
    def test_prompt_for_password(self):
1212
1216
        self.server.add_user('joe', 'foo')
1213
1217
        t = self.get_user_transport('joe', None)
1214
 
        ui.ui_factory = TestUIFactory(stdin='foo\n', stdout=StringIOWrapper())
 
1218
        ui.ui_factory = TestUIFactory(stdin='foo\n')
1215
1219
        self.assertEqual('contents of a\n',t.get('a').read())
1216
1220
        # stdin should be empty
1217
1221
        self.assertEqual('', ui.ui_factory.stdin.readline())