diff options
Diffstat (limited to 'debian/tests/usage/pop3')
-rwxr-xr-x | debian/tests/usage/pop3 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/tests/usage/pop3 b/debian/tests/usage/pop3 new file mode 100755 index 0000000..00b1657 --- /dev/null +++ b/debian/tests/usage/pop3 @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import poplib + +print("Testing POP3") +print("Connecting") +client = poplib.POP3('localhost') +client.set_debuglevel(2) + +print("Checking for STARTTLS capability") +assert 'STLS' in client.capa() + +client.stls() + +print("Logging in") +client.user('dep8') +client.pass_('test') + +print("Listing INBOX") +res, data, _ = client.list() +assert res.startswith(b'+OK') + +print("Fetching and verifying test message") +for entry in data: + _id, _ = entry.split(maxsplit=1) + res, body, _ = client.retr(int(_id)) + if b'Subject: DEP-8 test' in body: + break +else: + raise AssertionError("Test message not found") + +print("Done") |