From 3980c1044c2bec9b4df0fd1d309ef32c430bf790 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Mon, 11 Jun 2012 01:20:32 +0900
Subject: [PATCH 2/2] Added Metalink test cases

---
 tests/data/Makefile.am |    2 +-
 tests/data/test2005    |   65 ++++++++++++++++++++++++++++++++++++++++
 tests/data/test2006    |   78 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+), 1 deletions(-)
 create mode 100644 tests/data/test2005
 create mode 100644 tests/data/test2006

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 7408547..9b5b3ab 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -92,7 +92,7 @@ test1371 test1372 test1373 test1374 test1375 test1376 test1377 test1378 \
 test1379 test1380 test1381 test1382 test1383 test1384 test1385 test1386 \
 test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
 test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
-test2000 test2001 test2002 test2003 test2004
+test2000 test2001 test2002 test2003 test2004 test2005 test2006
 
 EXTRA_DIST = $(TESTCASES) DISABLED
 
diff --git a/tests/data/test2005 b/tests/data/test2005
new file mode 100644
index 0000000..6227543
--- /dev/null
+++ b/tests/data/test2005
@@ -0,0 +1,65 @@
+<testcase>
+<info>
+<keywords>
+Metalink
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data1 nocheck="yes">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 35
+Connection: close
+Content-Type: application/metalink+xml
+Funny-head: yesyes
+
+All your metalink are belong to us
+</data1>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<features>
+Metalink
+</features>
+ <name>
+Local Metalink file parsing
+ </name>
+ <command option="no-include">
+--metalink log/metalink2005
+</command>
+<file name="log/metalink2005">
+<?xml version="1.0" encoding="utf-8"?><metalink version="3.0" generator="Metalink Editor version 1.1.0" xmlns="http://www.metalinker.org/"><files><file name="log/file2005"><verification><hash type="sha256">f47557729497cc64ee4cd1eefc9709220800252ce045617c1b358608c7bc860a</hash></verification><resources maxconnections="1"><url type="http" preference="99">http://%HOSTIP:%HTTPPORT/20050001</url></resources></file></files></metalink>
+</file>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /20050001 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol>
+<file name="log/file2005">
+All your metalink are belong to us
+</file>
+</verify>
+</testcase>
diff --git a/tests/data/test2006 b/tests/data/test2006
new file mode 100644
index 0000000..b42766e
--- /dev/null
+++ b/tests/data/test2006
@@ -0,0 +1,78 @@
+<testcase>
+<info>
+<keywords>
+Metalink
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data2 nocheck="yes">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Connection: close
+Content-Type: application/metalink+xml
+Funny-head: swsclose
+
+All your metalink are belong to us
+</data2>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<features>
+Metalink
+</features>
+ <name>
+Get and parse Metalink, and download URL described in Metalink
+ </name>
+ <command option="no-include">
+http://%HOSTIP:%HTTPPORT/2006!test2006.metalink
+</command>
+<file name="log/test2006.metalink">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Connection: close
+Content-Type: application/metalink+xml
+Funny-head: swsclose
+
+<?xml version="1.0" encoding="utf-8"?><metalink version="3.0" generator="Metalink Editor version 1.1.0" xmlns="http://www.metalinker.org/"><files><file name="log/file2006"><verification><hash type="sha1">296ed97309b5a214c3568ee89b9c1013cfd19cf2</hash></verification><resources maxconnections="1"><url type="http" preference="99">http://%HOSTIP:%HTTPPORT/20060002</url></resources></file></files></metalink>
+</file>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /2006!test2006.metalink HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+GET /20060002 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol>
+<file name="log/file2006">
+All your metalink are belong to us
+</file>
+</verify>
+</testcase>
-- 
1.7.9.1

