105 lines
5.3 KiB
Go
105 lines
5.3 KiB
Go
package nomad
|
||
|
||
import "testing"
|
||
|
||
var sampleRSS = `<?xml version='1.0' encoding='UTF-8'?>
|
||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
|
||
<channel>
|
||
<title>kyle@ nomad</title>
|
||
<link>https://nomad.wntrmute.net/u/kyle.rss</link>
|
||
<description>An experiment in MMS micropublishing</description>
|
||
<atom:link href="https://nomad.wntrmute.net/u/kyle.rss" rel="self"/>
|
||
<docs>http://www.rssboard.org/rss-specification</docs>
|
||
<generator>python-feedgen</generator>
|
||
<lastBuildDate>Thu, 04 Nov 2021 16:44:41 +0000</lastBuildDate>
|
||
<item>
|
||
<title>kyle @ 2021-11-03 10:36:44 PDT: At least not with images, I guess.</title>
|
||
<link>https://nomad.wntrmute.net/p/1996</link>
|
||
<description>At least not with images, I guess.</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1996</guid>
|
||
<pubDate>Wed, 03 Nov 2021 10:36:44 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-11-03 10:35:53 PDT: This thing isn't working at all...</title>
|
||
<link>https://nomad.wntrmute.net/p/1995</link>
|
||
<description>This thing isn't working at all...</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1995</guid>
|
||
<pubDate>Wed, 03 Nov 2021 10:35:53 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-11-03 02:38:48 PDT: And a plain text post too...</title>
|
||
<link>https://nomad.wntrmute.net/p/1994</link>
|
||
<description>And a plain text post too...</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1994</guid>
|
||
<pubDate>Wed, 03 Nov 2021 02:38:48 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-11-03 02:23:29 PDT: Working on a thing that needs a test post so here’s a picture of...</title>
|
||
<link>https://nomad.wntrmute.net/p/1993</link>
|
||
<description>Working on a thing that needs a test post so here’s a picture of some mead.</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1993</guid>
|
||
<enclosure url="https://nomad.sfo2.cdn.digitaloceanspaces.com/MM95aee9af66546a4ef9b66ea8168b359c.jpg" length="194792" type="image/jpeg"/>
|
||
<pubDate>Wed, 03 Nov 2021 02:23:29 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-31 22:44:56 PDT: Fall colours in Oakland.</title>
|
||
<link>https://nomad.wntrmute.net/p/1991</link>
|
||
<description>Fall colours in Oakland.</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1991</guid>
|
||
<enclosure url="https://nomad.sfo2.cdn.digitaloceanspaces.com/MM7095b4db336c7d03b23f2cd702eb0e0a.jpg" length="426006" type="image/jpeg"/>
|
||
<pubDate>Sun, 31 Oct 2021 22:44:56 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-25 20:02:11 PDT: I am the operator of my pocket ... operator.</title>
|
||
<link>https://nomad.wntrmute.net/p/1990</link>
|
||
<description>I am the operator of my pocket ... operator.</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1990</guid>
|
||
<enclosure url="https://nomad.sfo2.cdn.digitaloceanspaces.com/MMe8e7ad7b08b18e9df53ac97d87c8faa0.jpg" length="232659" type="image/jpeg"/>
|
||
<pubDate>Mon, 25 Oct 2021 20:02:11 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-24 19:28:09 PDT: The Yeti being a backup battery that I got with a solar panel fo...</title>
|
||
<link>https://nomad.wntrmute.net/p/1989</link>
|
||
<description>The Yeti being a backup battery that I got with a solar panel for offgrid stuff, good test for it though </description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1989</guid>
|
||
<pubDate>Sun, 24 Oct 2021 19:28:09 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-24 19:27:14 PDT: Power's out, fortunately I have the Yeti</title>
|
||
<link>https://nomad.wntrmute.net/p/1988</link>
|
||
<description>Power's out, fortunately I have the Yeti</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1988</guid>
|
||
<pubDate>Sun, 24 Oct 2021 19:27:14 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-24 13:22:47 PDT: Finally exploring the trail behind my apartment, of course in th...</title>
|
||
<link>https://nomad.wntrmute.net/p/1986</link>
|
||
<description>Finally exploring the trail behind my apartment, of course in the rain.</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1986</guid>
|
||
<enclosure url="https://nomad.sfo2.cdn.digitaloceanspaces.com/MM6f13e74faa6d643d654507c5bd9d8f53.jpg" length="622207" type="image/jpeg"/>
|
||
<pubDate>Sun, 24 Oct 2021 13:22:47 -0700</pubDate>
|
||
</item>
|
||
<item>
|
||
<title>kyle @ 2021-10-24 09:33:15 PDT: From today’s Readwise email…</title>
|
||
<link>https://nomad.wntrmute.net/p/1984</link>
|
||
<description>From today’s Readwise email…</description>
|
||
<guid isPermaLink="true">https://nomad.wntrmute.net/p/1984</guid>
|
||
<enclosure url="https://nomad.sfo2.cdn.digitaloceanspaces.com/MMcc9d528ead93949ea21dd4b4aff21836.jpg" length="53704" type="image/jpeg"/>
|
||
<pubDate>Sun, 24 Oct 2021 09:33:15 -0700</pubDate>
|
||
</item>
|
||
</channel>
|
||
</rss>
|
||
`
|
||
|
||
func TestFetchRSS(t *testing.T) {
|
||
source := NewStringSource(sampleRSS)
|
||
items, err := FetchRSS(source)
|
||
if err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
|
||
if len(items) == 0 {
|
||
t.Fatal("no items parsed from RSS")
|
||
}
|
||
}
|