diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-08-07 18:50:54 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-08-07 18:55:20 +0000 |
commit | 84fa53cb3e2eb62d7eadba3ae1a3a81090413e5f (patch) | |
tree | bcedb2f343397ddceddfee1142b5c29d757c7688 /testing/perl-mail-sendmail/fake-smtp.py | |
parent | 702d5fdb2af2c4fab8782c59cd6d8ccc977936c1 (diff) | |
download | aports-84fa53cb3e2eb62d7eadba3ae1a3a81090413e5f.tar.bz2 aports-84fa53cb3e2eb62d7eadba3ae1a3a81090413e5f.tar.xz |
testing/perl-mail-sendmail: run test against dummy smtp
the test suite will send an actual email to the atuthor. We don't want
to do that and some of the build servers may have smtp port blocked.
Create a dummy smtp server on localhost and patch test to use that.
Diffstat (limited to 'testing/perl-mail-sendmail/fake-smtp.py')
-rw-r--r-- | testing/perl-mail-sendmail/fake-smtp.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/perl-mail-sendmail/fake-smtp.py b/testing/perl-mail-sendmail/fake-smtp.py new file mode 100644 index 0000000000..25929d9b8a --- /dev/null +++ b/testing/perl-mail-sendmail/fake-smtp.py @@ -0,0 +1,18 @@ +import smtpd +import asyncore + +class FakeSMTPServer(smtpd.SMTPServer): + """A Fake smtp server""" + + def __init__(*args, **kwargs): + smtpd.SMTPServer.__init__(*args, **kwargs) + + def process_message(*args, **kwargs): + pass + +if __name__ == "__main__": + smtp_server = FakeSMTPServer(('127.0.0.1', 2525), None) + try: + asyncore.loop(timeout=1, count=30) + except KeyboardInterrupt: + smtp_server.close() |