mirror of https://github.com/python/cpython
Use transient_internet() consistently in test_imaplib
This commit is contained in:
parent
b1aef23316
commit
924cbea467
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue