Patchwork [1,of,4,v2] hgweb: test for the atom and rss feeds

login
register
mail settings
Submitter Steven Brown
Date May 16, 2014, 2:47 p.m.
Message ID <79b7a531cefa9cfab4c3.1400251632@steve-debian.home>
Download mbox | patch
Permalink /patch/4783/
State Changes Requested
Headers show

Comments

Steven Brown - May 16, 2014, 2:47 p.m.
# HG changeset patch
# User Steven Brown <StevenGBrown@gmail.com>
# Date 1400244878 -28800
#      Fri May 16 20:54:38 2014 +0800
# Node ID 79b7a531cefa9cfab4c377821a2d9fcfae9821bf
# Parent  1ae3cd6f836c3c96ee3e9a872c8e966750910c2d
hgweb: test for the atom and rss feeds
Pierre-Yves David - May 16, 2014, 5:56 p.m.
On 05/16/2014 07:47 AM, Steven Brown wrote:
> # HG changeset patch
> # User Steven Brown <StevenGBrown@gmail.com>
> # Date 1400244878 -28800
> #      Fri May 16 20:54:38 2014 +0800
> # Node ID 79b7a531cefa9cfab4c377821a2d9fcfae9821bf
> # Parent  1ae3cd6f836c3c96ee3e9a872c8e966750910c2d
> hgweb: test for the atom and rss feeds
>
> diff --git a/tests/test-hgweb-feeds.t b/tests/test-hgweb-feeds.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-hgweb-feeds.t

Even if this appear to not be written in the Contribution guide line. We 
tend to avoid creating new test file  that contains a very small test. 
each new test file have a significant overhead.

Can you add this test to an exiting hgweb test instead?

The test looks otherwise good to me.


> @@ -0,0 +1,217 @@
> +  $ "$TESTDIR/hghave" serve || exit 80
> +
> +  $ hg init test
> +  $ cd test
> +
> +  $ touch foo
> +  $ hg add foo
> +  $ hg commit -d '1 0' -m 'Issue123: fixed the bug!'
> +  $ hg bookmark -r 1 bookmark1
> +  $ hg tag -r tip tag1 -m 'create tag1'
> +
> +  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
> +  $ cat hg.pid >> $DAEMON_PIDS
> +
> +atom-log
> +
> +  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "atom-log"
> +  200 Script output follows
> +
> +  <?xml version="1.0" encoding="ascii"?>
> +  <feed xmlns="http://www.w3.org/2005/Atom">
> +   <!-- Changelog -->
> +   <id>http://*:$HGPORT/</id> (glob)
> +   <link rel="self" href="http://*:$HGPORT/atom-log"/> (glob)
> +   <link rel="alternate" href="http://*:$HGPORT/"/> (glob)
> +   <title>test Changelog</title>
> +   <updated>1970-01-01T00:00:00+00:00</updated>
> +
> +   <entry>
> +    <title>[default] create tag1</title>
> +    <id>http://*:$HGPORT/#changeset-dfe5695e0fb2eaeca7404bead73008a13bc72881</id> (glob)
> +    <link href="http://*:$HGPORT/rev/dfe5695e0fb2"/> (glob)
> +    <author>
> +     <name>test</name>
> +     <email>&#116;&#101;&#115;&#116;</email>
> +    </author>
> +    <updated>1970-01-01T00:00:00+00:00</updated>
> +    <published>1970-01-01T00:00:00+00:00</published>
> +    <content type="xhtml">
> +  	<table xmlns="http://www.w3.org/1999/xhtml">
> +  	<tr>
> +  		<th style="text-align:left;">changeset</th>
> +  		<td>dfe5695e0fb2</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">branch</th>
> +                                <td>default</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">bookmark</th>
> +  		<td></td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">tag</th>
> +  		<td>tip</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">user</th>
> +  		<td>&#116;&#101;&#115;&#116;</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">description</th>
> +  		<td>create tag1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">files</th>
> +  		<td>.hgtags<br /></td>
> +  	</tr>
> +  	</table>
> +    </content>
> +   </entry>
> +   <entry>
> +    <title>Issue123: fixed the bug!</title>
> +    <id>http://*:$HGPORT/#changeset-1b0e7ece6bd607b31374ec8862f96ad475e7ee70</id> (glob)
> +    <link href="http://*:$HGPORT/rev/1b0e7ece6bd6"/> (glob)
> +    <author>
> +     <name>test</name>
> +     <email>&#116;&#101;&#115;&#116;</email>
> +    </author>
> +    <updated>1970-01-01T00:00:01+00:00</updated>
> +    <published>1970-01-01T00:00:01+00:00</published>
> +    <content type="xhtml">
> +  	<table xmlns="http://www.w3.org/1999/xhtml">
> +  	<tr>
> +  		<th style="text-align:left;">changeset</th>
> +  		<td>1b0e7ece6bd6</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">branch</th>
> +                                <td></td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">bookmark</th>
> +  		<td>bookmark1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">tag</th>
> +  		<td>tag1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">user</th>
> +  		<td>&#116;&#101;&#115;&#116;</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">description</th>
> +  		<td>Issue123: fixed the bug!</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">files</th>
> +  		<td>foo<br /></td>
> +  	</tr>
> +  	</table>
> +    </content>
> +   </entry>
> +
> +  </feed>
> +
> +  $ cat errors.log
> +
> +rss-log
> +
> +  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "rss-log"
> +  200 Script output follows
> +
> +  <?xml version="1.0" encoding="ascii"?>
> +  <rss version="2.0">
> +    <channel>
> +      <link>http://*:$HGPORT/</link> (glob)
> +      <language>en-us</language>
> +
> +      <title>test Changelog</title>
> +      <description>test Changelog</description>
> +      <item>
> +      <title>[default] create tag1</title>
> +      <guid isPermaLink="true">http://*:$HGPORT/rev/dfe5695e0fb2</guid> (glob)
> +               <link>http://*:$HGPORT/rev/dfe5695e0fb2</link> (glob)
> +      <description>
> +                <![CDATA[
> +  	<table>
> +  	<tr>
> +  		<th style="text-align:left;">changeset</th>
> +  		<td>dfe5695e0fb2</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">branch</th>
> +                                <td>default</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">bookmark</th>
> +  		<td></td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">tag</th>
> +  		<td>tip</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">user</th>
> +  		<td>&#116;&#101;&#115;&#116;</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">description</th>
> +  		<td>create tag1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">files</th>
> +  		<td>.hgtags<br /></td>
> +  	</tr>
> +  	</table>
> +  	]]></description>
> +      <author>&#116;&#101;&#115;&#116;</author>
> +      <pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate>
> +  </item>
> +  <item>
> +      <title>Issue123: fixed the bug!</title>
> +      <guid isPermaLink="true">http://*:$HGPORT/rev/1b0e7ece6bd6</guid> (glob)
> +               <link>http://*:$HGPORT/rev/1b0e7ece6bd6</link> (glob)
> +      <description>
> +                <![CDATA[
> +  	<table>
> +  	<tr>
> +  		<th style="text-align:left;">changeset</th>
> +  		<td>1b0e7ece6bd6</td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">branch</th>
> +                                <td></td>
> +                </tr>
> +                <tr>
> +                                <th style="text-align:left;">bookmark</th>
> +  		<td>bookmark1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;">tag</th>
> +  		<td>tag1</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">user</th>
> +  		<td>&#116;&#101;&#115;&#116;</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">description</th>
> +  		<td>Issue123: fixed the bug!</td>
> +  	</tr>
> +  	<tr>
> +  		<th style="text-align:left;vertical-align:top;">files</th>
> +  		<td>foo<br /></td>
> +  	</tr>
> +  	</table>
> +  	]]></description>
> +      <author>&#116;&#101;&#115;&#116;</author>
> +      <pubDate>Thu, 01 Jan 1970 00:00:01 +0000</pubDate>
> +  </item>
> +
> +    </channel>
> +  </rss> (no-eol)
> +
> +  $ cat errors.log
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/tests/test-hgweb-feeds.t b/tests/test-hgweb-feeds.t
new file mode 100644
--- /dev/null
+++ b/tests/test-hgweb-feeds.t
@@ -0,0 +1,217 @@ 
+  $ "$TESTDIR/hghave" serve || exit 80
+
+  $ hg init test
+  $ cd test
+
+  $ touch foo
+  $ hg add foo
+  $ hg commit -d '1 0' -m 'Issue123: fixed the bug!'
+  $ hg bookmark -r 1 bookmark1
+  $ hg tag -r tip tag1 -m 'create tag1'
+
+  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+atom-log
+
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "atom-log"
+  200 Script output follows
+  
+  <?xml version="1.0" encoding="ascii"?>
+  <feed xmlns="http://www.w3.org/2005/Atom">
+   <!-- Changelog -->
+   <id>http://*:$HGPORT/</id> (glob)
+   <link rel="self" href="http://*:$HGPORT/atom-log"/> (glob)
+   <link rel="alternate" href="http://*:$HGPORT/"/> (glob)
+   <title>test Changelog</title>
+   <updated>1970-01-01T00:00:00+00:00</updated>
+  
+   <entry>
+    <title>[default] create tag1</title>
+    <id>http://*:$HGPORT/#changeset-dfe5695e0fb2eaeca7404bead73008a13bc72881</id> (glob)
+    <link href="http://*:$HGPORT/rev/dfe5695e0fb2"/> (glob)
+    <author>
+     <name>test</name>
+     <email>&#116;&#101;&#115;&#116;</email>
+    </author>
+    <updated>1970-01-01T00:00:00+00:00</updated>
+    <published>1970-01-01T00:00:00+00:00</published>
+    <content type="xhtml">
+  	<table xmlns="http://www.w3.org/1999/xhtml">
+  	<tr>
+  		<th style="text-align:left;">changeset</th>
+  		<td>dfe5695e0fb2</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">branch</th>
+                                <td>default</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">bookmark</th>
+  		<td></td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">tag</th>
+  		<td>tip</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">user</th>
+  		<td>&#116;&#101;&#115;&#116;</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">description</th>
+  		<td>create tag1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">files</th>
+  		<td>.hgtags<br /></td>
+  	</tr>
+  	</table>
+    </content>
+   </entry>
+   <entry>
+    <title>Issue123: fixed the bug!</title>
+    <id>http://*:$HGPORT/#changeset-1b0e7ece6bd607b31374ec8862f96ad475e7ee70</id> (glob)
+    <link href="http://*:$HGPORT/rev/1b0e7ece6bd6"/> (glob)
+    <author>
+     <name>test</name>
+     <email>&#116;&#101;&#115;&#116;</email>
+    </author>
+    <updated>1970-01-01T00:00:01+00:00</updated>
+    <published>1970-01-01T00:00:01+00:00</published>
+    <content type="xhtml">
+  	<table xmlns="http://www.w3.org/1999/xhtml">
+  	<tr>
+  		<th style="text-align:left;">changeset</th>
+  		<td>1b0e7ece6bd6</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">branch</th>
+                                <td></td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">bookmark</th>
+  		<td>bookmark1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">tag</th>
+  		<td>tag1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">user</th>
+  		<td>&#116;&#101;&#115;&#116;</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">description</th>
+  		<td>Issue123: fixed the bug!</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">files</th>
+  		<td>foo<br /></td>
+  	</tr>
+  	</table>
+    </content>
+   </entry>
+  
+  </feed>
+
+  $ cat errors.log
+
+rss-log
+
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "rss-log"
+  200 Script output follows
+  
+  <?xml version="1.0" encoding="ascii"?>
+  <rss version="2.0">
+    <channel>
+      <link>http://*:$HGPORT/</link> (glob)
+      <language>en-us</language>
+  
+      <title>test Changelog</title>
+      <description>test Changelog</description>
+      <item>
+      <title>[default] create tag1</title>
+      <guid isPermaLink="true">http://*:$HGPORT/rev/dfe5695e0fb2</guid> (glob)
+               <link>http://*:$HGPORT/rev/dfe5695e0fb2</link> (glob)
+      <description>
+                <![CDATA[
+  	<table>
+  	<tr>
+  		<th style="text-align:left;">changeset</th>
+  		<td>dfe5695e0fb2</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">branch</th>
+                                <td>default</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">bookmark</th>
+  		<td></td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">tag</th>
+  		<td>tip</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">user</th>
+  		<td>&#116;&#101;&#115;&#116;</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">description</th>
+  		<td>create tag1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">files</th>
+  		<td>.hgtags<br /></td>
+  	</tr>
+  	</table>
+  	]]></description>
+      <author>&#116;&#101;&#115;&#116;</author>
+      <pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate>
+  </item>
+  <item>
+      <title>Issue123: fixed the bug!</title>
+      <guid isPermaLink="true">http://*:$HGPORT/rev/1b0e7ece6bd6</guid> (glob)
+               <link>http://*:$HGPORT/rev/1b0e7ece6bd6</link> (glob)
+      <description>
+                <![CDATA[
+  	<table>
+  	<tr>
+  		<th style="text-align:left;">changeset</th>
+  		<td>1b0e7ece6bd6</td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">branch</th>
+                                <td></td>
+                </tr>
+                <tr>
+                                <th style="text-align:left;">bookmark</th>
+  		<td>bookmark1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;">tag</th>
+  		<td>tag1</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">user</th>
+  		<td>&#116;&#101;&#115;&#116;</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">description</th>
+  		<td>Issue123: fixed the bug!</td>
+  	</tr>
+  	<tr>
+  		<th style="text-align:left;vertical-align:top;">files</th>
+  		<td>foo<br /></td>
+  	</tr>
+  	</table>
+  	]]></description>
+      <author>&#116;&#101;&#115;&#116;</author>
+      <pubDate>Thu, 01 Jan 1970 00:00:01 +0000</pubDate>
+  </item>
+  
+    </channel>
+  </rss> (no-eol)
+
+  $ cat errors.log