~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Mattias Eriksson
  • Date: 2009-06-02 09:18:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4398.
  • Revision ID: snaggen@acc.umu.se-20090602091826-r55iaxfwy9fn1up3
Fix to avoid possible race conditions if import ordering is changed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1569
1569
        self.server.add_user('joe', 'foo')
1570
1570
        t = self.get_user_transport(None, None)
1571
1571
        stdout = tests.StringIOWrapper()
1572
 
        stderr = tests.StringIOWrapper()
1573
 
        ui.ui_factory = tests.TestUIFactory(stdin='joe\nfoo\n',
1574
 
                                            stdout=stdout, stderr=stderr)
 
1572
        ui.ui_factory = tests.TestUIFactory(stdin='joe\nfoo\n', stdout=stdout)
1575
1573
        self.assertEqual('contents of a\n',t.get('a').read())
1576
1574
        # stdin should be empty
1577
1575
        self.assertEqual('', ui.ui_factory.stdin.readline())
1578
 
        stderr.seek(0)
 
1576
        stdout.seek(0)
1579
1577
        expected_prompt = self._expected_username_prompt(t._unqualified_scheme)
1580
 
        self.assertEquals(expected_prompt, stderr.read(len(expected_prompt)))
1581
 
        self.assertEquals('', stdout.getvalue())
 
1578
        self.assertEquals(expected_prompt, stdout.read(len(expected_prompt)))
1582
1579
        self._check_password_prompt(t._unqualified_scheme, 'joe',
1583
 
                                    stderr.readline())
 
1580
                                    stdout.readline())
1584
1581
 
1585
1582
    def test_prompt_for_password(self):
1586
1583
        if self._testing_pycurl():
1591
1588
        self.server.add_user('joe', 'foo')
1592
1589
        t = self.get_user_transport('joe', None)
1593
1590
        stdout = tests.StringIOWrapper()
1594
 
        stderr = tests.StringIOWrapper()
1595
 
        ui.ui_factory = tests.TestUIFactory(stdin='foo\n',
1596
 
                                            stdout=stdout, stderr=stderr)
1597
 
        self.assertEqual('contents of a\n', t.get('a').read())
 
1591
        ui.ui_factory = tests.TestUIFactory(stdin='foo\n', stdout=stdout)
 
1592
        self.assertEqual('contents of a\n',t.get('a').read())
1598
1593
        # stdin should be empty
1599
1594
        self.assertEqual('', ui.ui_factory.stdin.readline())
1600
1595
        self._check_password_prompt(t._unqualified_scheme, 'joe',
1601
 
                                    stderr.getvalue())
1602
 
        self.assertEquals('', stdout.getvalue())
 
1596
                                    stdout.getvalue())
1603
1597
        # And we shouldn't prompt again for a different request
1604
1598
        # against the same transport.
1605
1599
        self.assertEqual('contents of b\n',t.get('b').read())