(self)
| 1229 | smtp.close() |
| 1230 | |
| 1231 | def test_auth_function(self): |
| 1232 | supported = {'PLAIN', 'LOGIN'} |
| 1233 | try: |
| 1234 | hashlib.md5() |
| 1235 | except ValueError: |
| 1236 | pass |
| 1237 | else: |
| 1238 | supported.add('CRAM-MD5') |
| 1239 | for mechanism in supported: |
| 1240 | self.serv.add_feature("AUTH {}".format(mechanism)) |
| 1241 | for mechanism in supported: |
| 1242 | with self.subTest(mechanism=mechanism): |
| 1243 | smtp = smtplib.SMTP(HOST, self.port, |
| 1244 | local_hostname='localhost', |
| 1245 | timeout=support.LOOPBACK_TIMEOUT) |
| 1246 | smtp.ehlo('foo') |
| 1247 | smtp.user, smtp.password = sim_auth[0], sim_auth[1] |
| 1248 | method = 'auth_' + mechanism.lower().replace('-', '_') |
| 1249 | resp = smtp.auth(mechanism, getattr(smtp, method)) |
| 1250 | self.assertEqual(resp, (235, b'Authentication Succeeded')) |
| 1251 | smtp.close() |
| 1252 | |
| 1253 | def test_quit_resets_greeting(self): |
| 1254 | smtp = smtplib.SMTP(HOST, self.port, |
nothing calls this directly
no test coverage detected