Use transient_internet() consistently in test_imaplib

This commit is contained in:
Antoine Pitrou 2011-03-23 03:10:14 +01:00
parent b1aef23316
commit 924cbea467
1 changed files with 16 additions and 12 deletions

View File

@ -219,20 +219,23 @@ class RemoteIMAPTest(unittest.TestCase):
def tearDown(self):
if self.server is not None:
self.server.logout()
with transient_internet(self.host):
self.server.logout()
def test_logincapa(self):
for cap in self.server.capabilities:
self.assertIsInstance(cap, str)
self.assertTrue('LOGINDISABLED' in self.server.capabilities)
self.assertTrue('AUTH=ANONYMOUS' in self.server.capabilities)
rs = self.server.login(self.username, self.password)
self.assertEqual(rs[0], 'OK')
with transient_internet(self.host):
for cap in self.server.capabilities:
self.assertIsInstance(cap, str)
self.assertTrue('LOGINDISABLED' in self.server.capabilities)
self.assertTrue('AUTH=ANONYMOUS' in self.server.capabilities)
rs = self.server.login(self.username, self.password)
self.assertEqual(rs[0], 'OK')
def test_logout(self):
rs = self.server.logout()
self.server = None
self.assertEqual(rs[0], 'BYE')
with transient_internet(self.host):
rs = self.server.logout()
self.server = None
self.assertEqual(rs[0], 'BYE')
@unittest.skipUnless(ssl, "SSL not available")
@ -240,8 +243,9 @@ class RemoteIMAP_STARTTLSTest(RemoteIMAPTest):
def setUp(self):
super().setUp()
rs = self.server.starttls()
self.assertEqual(rs[0], 'OK')
with transient_internet(self.host):
rs = self.server.starttls()
self.assertEqual(rs[0], 'OK')
def test_logincapa(self):
for cap in self.server.capabilities: