Rev 5354: Fix fallouts, including an unclear test. in file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Jul 19 13:54:54 BST 2010
At file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/
------------------------------------------------------------
revno: 5354
revision-id: v.ladeuil+lp at free.fr-20100719125454-0p46seg0nee5r0fg
parent: v.ladeuil+lp at free.fr-20100719101033-34jbrhpv36qy2r7h
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: simplify-test-config-building
timestamp: Mon 2010-07-19 14:54:54 +0200
message:
Fix fallouts, including an unclear test.
* bzrlib/tests/test_smtp_connection.py
(TestSMTPConnection.get_connection): '_content' is a string now.
(test_authenticate_with_byte_strings): Clarify the test intent and
fix it to respect config files content being utf-8 encoded from a
basestring (str or unicode).
* bzrlib/plugins/launchpad/test_account.py:
(LaunchpadAccountTests.setup_config): '_content' is just a string now.
-------------- next part --------------
=== modified file 'bzrlib/plugins/launchpad/test_account.py'
--- a/bzrlib/plugins/launchpad/test_account.py 2010-07-19 10:08:39 +0000
+++ b/bzrlib/plugins/launchpad/test_account.py 2010-07-19 12:54:54 +0000
@@ -26,7 +26,7 @@
class LaunchpadAccountTests(TestCaseInTempDir):
def setup_config(self, text):
- my_config = config.GlobalConfig(_content=StringIO(text))
+ my_config = config.GlobalConfig(_content=text)
return my_config
def test_get_lp_login_unconfigured(self):
=== modified file 'bzrlib/tests/test_smtp_connection.py'
--- a/bzrlib/tests/test_smtp_connection.py 2010-07-19 10:08:39 +0000
+++ b/bzrlib/tests/test_smtp_connection.py 2010-07-19 12:54:54 +0000
@@ -91,7 +91,7 @@
class TestSMTPConnection(tests.TestCaseInTempDir):
def get_connection(self, text, smtp_factory=None):
- my_config = config.GlobalConfig(_content=StringIO(text))
+ my_config = config.GlobalConfig(_content=text)
return smtp_connection.SMTPConnection(my_config,
_smtp_factory=smtp_factory)
@@ -158,17 +158,18 @@
def test_authenticate_with_byte_strings(self):
user = 'joe'
- password = 'h\xC3\xACspass'
+ unicode_pass = u'h\xECspass'
+ utf8_pass = unicode_pass.encode('utf-8')
factory = WideOpenSMTPFactory()
conn = self.get_connection(
- '[DEFAULT]\nsmtp_username=%s\nsmtp_password=%s\n'
- % (user, password), smtp_factory=factory)
- self.assertEqual(u'h\xECspass', conn._smtp_password)
+ u'[DEFAULT]\nsmtp_username=%s\nsmtp_password=%s\n'
+ % (user, unicode_pass), smtp_factory=factory)
+ self.assertEqual(unicode_pass, conn._smtp_password)
conn._connect()
self.assertEqual([('connect', 'localhost'),
('ehlo',),
('has_extn', 'starttls'),
- ('login', user, password)], factory._calls)
+ ('login', user, utf8_pass)], factory._calls)
smtp_username, smtp_password = factory._calls[-1][1:]
self.assertIsInstance(smtp_username, str)
self.assertIsInstance(smtp_password, str)
More information about the bazaar-commits
mailing list