diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-11-23 19:07:39 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-11-23 19:07:39 (GMT) |
commit | 25cee19beb3117f834100cf29cff625c98d0da29 (patch) | |
tree | 327c7f85c59825754afd328915afd57072439f5d /Lib/test/test_poplib.py | |
parent | d89824b0e2fa9a44b56394a5185de737a6527ea7 (diff) | |
download | cpython-25cee19beb3117f834100cf29cff625c98d0da29.zip cpython-25cee19beb3117f834100cf29cff625c98d0da29.tar.gz cpython-25cee19beb3117f834100cf29cff625c98d0da29.tar.bz2 |
Issue #4473: Add a POP3.capa() method to query the capabilities advertised by the POP3 server.
Patch by Lorenzo Catucci.
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r-- | Lib/test/test_poplib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index c0929a0..8fe0c4cb 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -33,6 +33,8 @@ line3\r\n\ class DummyPOP3Handler(asynchat.async_chat): + CAPAS = {'UIDL': [], 'IMPLEMENTATION': ['python-testlib-pop-server']} + def __init__(self, conn): asynchat.async_chat.__init__(self, conn) self.set_terminator(b"\r\n") @@ -112,6 +114,16 @@ class DummyPOP3Handler(asynchat.async_chat): self.push('+OK closing.') self.close_when_done() + def cmd_capa(self, arg): + self.push('+OK Capability list follows') + if self.CAPAS: + for cap, params in self.CAPAS.items(): + _ln = [cap] + if params: + _ln.extend(params) + self.push(' '.join(_ln)) + self.push('.') + class DummyPOP3Server(asyncore.dispatcher, threading.Thread): @@ -232,6 +244,10 @@ class TestPOP3Class(TestCase): self.client.uidl() self.client.uidl('foo') + def test_capa(self): + capa = self.client.capa() + self.assertTrue('IMPLEMENTATION' in capa.keys()) + def test_quit(self): resp = self.client.quit() self.assertTrue(resp) |