Commit 02e038a4 authored by Lysander Trischler's avatar Lysander Trischler
Browse files

Add test for metadata and upgrade to recent yarn

parent c69bbbcc
all: libtwtxt.so run
libtwtxt.so: libtwtxt.go
libtwtxt.so: libtwtxt.go go.mod
go build -buildmode=c-shared -o libtwtxt.so
clean:
......
......@@ -2,4 +2,4 @@ module libtwtxt
go 1.16
require git.mills.io/yarnsocial/yarn v0.0.0-20210724071000-1727771047f8
require git.mills.io/yarnsocial/yarn v0.0.0-20211026064839-fcc23c94f5c1
This diff is collapsed.
......@@ -109,6 +109,38 @@ class ParseFileTest(unittest.TestCase):
links=[],
tags=[Link(text="eggs", target="https://example.com/eggs")])]), twtfile)
def test_metadata(self):
self.maxDiff = None
twtfile = parse_file(
"# nick = eugen\n"
"# url = https://example.org/eugen/twtxt.txt\n"
"# avatar = https://example.org/eugen/avatar.jpg\n"
"# description = The greatest feed on earth\n"
"2021-10-25T14:17:13+02:00\tThe metadata should override the twter information.\n"
"2021-10-25T14:18:35+02:00\tAnd it does. Great.",
TWTER)
expectedTwter = Twter(nick="eugen",
url="https://example.org/eugen/twtxt.txt",
avatar="https://example.org/eugen/avatar.jpg",
tagline="The greatest feed on earth")
self.assertEqual(expectedTwter, twtfile.twter, "twter of twtfile does not match")
self.assertEqual(expectedTwter, twtfile.twts[0].twter, "twter of first twt does not match")
self.assertEqual(TwtFile(twter=expectedTwter, twts=[
Twt(twter=expectedTwter,
created=datetime.datetime(2021, 10, 25, 14, 17, 13, tzinfo=UTC_PLUS_2),
hash="ckgkqaa",
subject=Subject(text="#ckgkqaa", tag=Link(text="ckgkqaa", target=None)),
mentions=[],
links=[],
tags=[]),
Twt(twter=expectedTwter,
created=datetime.datetime(2021, 10, 25, 14, 18, 35, tzinfo=UTC_PLUS_2),
hash="k6xkknq",
subject=Subject(text="#k6xkknq", tag=Link(text="k6xkknq", target=None)),
mentions=[],
links=[],
tags=[])]), twtfile)
if __name__ == "__main__":
unittest.main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment