D2839: tests: use $HTTP_DATE$ for Date header
This revision was automatically updated to reflect the committed changes. Closed by commit rHG16203c6079e7: tests: use $HTTP_DATE$ for Date header (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2839?vs=6992&id=7154 REVISION DETAIL https://phab.mercurial-scm.org/D2839 AFFECTED FILES tests/common-pattern.py tests/test-archive.t tests/test-hgweb-commands.t tests/test-http-protocol.t CHANGE DETAILS diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t --- a/tests/test-http-protocol.t +++ b/tests/test-http-protocol.t @@ -49,41 +49,41 @@ $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Server should send application/mercurial-0.1 when client says it wants it $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Server should send application/mercurial-0.2 when client says it wants it $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.2 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.2 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Requesting a compression format that server doesn't support results will fall back to 0.1 $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked @@ -105,7 +105,7 @@ 200 Script output follows content-length: 41 content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) e93700bd72895c5addab234c56d4024b487a362f diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -1923,7 +1923,7 @@ 404 Not Found content-length: 12 content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) 0 diff --git a/tests/test-archive.t b/tests/test-archive.t --- a/tests/test-archive.t +++ b/tests/test-archive.t @@ -126,24 +126,24 @@ 200 Script output follows content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz content-type: application/x-gzip - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 % tar.bz2 and zip disallowed should both give 403 403 Archive type not allowed: bz2 content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352 403 Archive type not allowed: zip content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked @@ -154,24 +154,24 @@ 200 Script output follows content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2 content-type: application/x-bzip2 - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b % zip and tar.gz disallowed should both give 403 403 Archive type not allowed: zip content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7 403 Archive type not allowed: gz content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked @@ -182,24 +182,2
D2839: tests: use $HTTP_DATE$ for Date header
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Support for the $HTTP_DATE$ substitution was recently added. Let's adopt it more widely. We had to tweak the substitution to be case insensitive, since HTTP headers are case insensitive. I also found a minor test issue not globbing over the length of the Server response header. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2839 AFFECTED FILES tests/common-pattern.py tests/test-archive.t tests/test-hgweb-commands.t tests/test-http-protocol.t CHANGE DETAILS diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t --- a/tests/test-http-protocol.t +++ b/tests/test-http-protocol.t @@ -49,41 +49,41 @@ $ get-with-headers.py --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Server should send application/mercurial-0.1 when client says it wants it $ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Server should send application/mercurial-0.2 when client says it wants it $ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.2 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked $ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.2 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked Requesting a compression format that server doesn't support results will fall back to 0.1 $ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=' - 200 Script output follows content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) transfer-encoding: chunked @@ -105,7 +105,7 @@ 200 Script output follows content-length: 41 content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) e93700bd72895c5addab234c56d4024b487a362f diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -1922,7 +1922,7 @@ 404 Not Found content-length: 12 content-type: application/mercurial-0.1 - date: * (glob) + date: $HTTP_DATE$ server: * (glob) 0 diff --git a/tests/test-archive.t b/tests/test-archive.t --- a/tests/test-archive.t +++ b/tests/test-archive.t @@ -126,24 +126,24 @@ 200 Script output follows content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz content-type: application/x-gzip - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 % tar.bz2 and zip disallowed should both give 403 403 Archive type not allowed: bz2 content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352 403 Archive type not allowed: zip content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked @@ -154,24 +154,24 @@ 200 Script output follows content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2 content-type: application/x-bzip2 - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b % zip and tar.gz disallowed should both give 403 403 Archive type not allowed: zip content-type: text/html; charset=ascii - date: * (glob) + date: $HTTP_DATE$ etag: W/"*" (glob) server: * (glob) transfer-encoding: chunked body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7 403 Archive type not allowed: gz content-typ