diff tests/test-url-download.t @ 35562:6580cf751418

debug: add a 'debugdownload' command This command resolve and fetch and URL through the Mercurial logic. Mercurial logic add various headers (including authentication) while resolving an URL so the commands helps with building the same request Mercurial would be doing. A new test file is created because we'll add more logic regarding Mercurial download logic and it will grow to a reasonable size.
author Boris Feld <boris.feld@octobus.net>
date Fri, 15 Dec 2017 09:30:16 +0100
parents
children cf841f2b5a72
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-url-download.t	Fri Dec 15 09:30:16 2017 +0100
@@ -0,0 +1,36 @@
+#require serve
+
+  $ hg init server
+  $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E ../error.log
+  $ cat hg1.pid >> $DAEMON_PIDS
+
+Check basic fetching
+
+  $ hg debugdownload "http://localhost:$HGPORT/?cmd=lookup&key=tip"
+  1 0000000000000000000000000000000000000000
+  $ hg debugdownload  -o null.txt "http://localhost:$HGPORT/?cmd=lookup&key=null"
+  $ cat null.txt
+  1 0000000000000000000000000000000000000000
+
+Check the request is made from the usual Mercurial logic
+(rev details, give different content if the request has a Mercurial user agent)
+
+  $ get-with-headers.py --headeronly "localhost:$HGPORT" "rev/tip" content-type
+  200 Script output follows
+  content-type: text/html; charset=ascii
+  $ hg debugdownload "http://localhost:$HGPORT/rev/tip"
+  
+  # HG changeset patch
+  # User 
+  # Date 0 0
+  # Node ID 0000000000000000000000000000000000000000
+  
+  
+  
+  
+
+Check other kind of compatible url
+
+  $ hg debugdownload ./null.txt
+  1 0000000000000000000000000000000000000000
+