From ef6d4da30135a7c511ea0eebb42176bec29dedcd Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 21 Oct 2012 20:13:12 -0400 Subject: [PATCH] pgp: don't assume protocol/micalg ordering in doctest output. The Content-Type header is eventually set by Message.add_header(), which gets extra parameters from **_params and iterates over them with _params.items(). _params is a dict, so .items() is not sorted. I forced the ordering in the pgp-mime doctests, so here I assume the micalg field is correct and just use ELLIPSIS. --- pygrader/handler/get.py | 8 ++++---- pygrader/handler/grade.py | 4 ++-- pygrader/mailpipe.py | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pygrader/handler/get.py b/pygrader/handler/get.py index d3e69cb..626e0e0 100644 --- a/pygrader/handler/get.py +++ b/pygrader/handler/get.py @@ -135,7 +135,7 @@ def run(basedir, course, message, person, subject, ... person=person, subject='[get]', max_late=0) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -190,7 +190,7 @@ def run(basedir, course, message, person, subject, ... person=person, subject='[get]', max_late=0) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -233,7 +233,7 @@ def run(basedir, course, message, person, subject, ... max_late=0) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -305,7 +305,7 @@ def run(basedir, course, message, person, subject, ... max_late=0) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... diff --git a/pygrader/handler/grade.py b/pygrader/handler/grade.py index 891495a..5d4f9a7 100644 --- a/pygrader/handler/grade.py +++ b/pygrader/handler/grade.py @@ -96,7 +96,7 @@ def run(basedir, course, message, person, subject, ... person=person, subject='[grade] {}, {}'.format(student.name, assignment.name)) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -137,7 +137,7 @@ def run(basedir, course, message, person, subject, ... person=person, subject='[grade] {}, {}'.format(student.name, assignment.name)) ... # doctest: +ELLIPSIS, +REPORT_UDIFF respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... diff --git a/pygrader/mailpipe.py b/pygrader/mailpipe.py index be7b1a0..90d1bcb 100644 --- a/pygrader/mailpipe.py +++ b/pygrader/mailpipe.py @@ -183,7 +183,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> message['Return-Path'] = '' >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -248,7 +248,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> message['Return-Path'] = '' >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -314,7 +314,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, ... 'for ; Mon, 09 Oct 2011 11:50:46 -0400 (EDT)') >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -381,7 +381,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> message['Message-ID'] = '' >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -423,7 +423,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> message['Subject'] = '[submit] attendance 1' >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -488,7 +488,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> message['Subject'] = 'need help for the first homework' >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -552,7 +552,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> del message['Subject'] >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/signed; ...protocol="application/pgp-signature"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... @@ -616,7 +616,7 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None, >>> del message['Subject'] >>> process(message) # doctest: +REPORT_UDIFF, +ELLIPSIS respond with: - Content-Type: multipart/encrypted; protocol="application/pgp-encrypted"; micalg="pgp-sha1"; boundary="===============...==" + Content-Type: multipart/encrypted; ...protocol="application/pgp-encrypted"; ...boundary="===============...==" MIME-Version: 1.0 Content-Disposition: inline Date: ... -- 2.26.2