From 979fd8329b169400522c51c67eb0048cb0476696 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Wed, 6 Sep 2006 11:19:46 -0400 Subject: [PATCH] FOAF Online Accounts --- THANKS | 1 + examples/foaf-based.ini | 5 +- planet/config.py | 2 +- tests/data/config/eliast.foaf | 178 ++++++++++++++++++++++++++++++++++ tests/data/config/foaf.ini | 10 ++ tests/data/config/rlist.ini | 3 +- tests/test_foaf.py | 19 +++- 7 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 tests/data/config/eliast.foaf create mode 100644 tests/data/config/foaf.ini diff --git a/THANKS b/THANKS index 726e560..f7004e7 100644 --- a/THANKS +++ b/THANKS @@ -1,5 +1,6 @@ DeWitt Clinton - Mac OSX Mary Gardiner - PythonPath +Elias Torres - FOAF OnlineAccounts This codebase represents a radical refactoring of Planet 2.0, which lists the following contributors: diff --git a/examples/foaf-based.ini b/examples/foaf-based.ini index dd4e48a..3ea5f58 100644 --- a/examples/foaf-based.ini +++ b/examples/foaf-based.ini @@ -39,5 +39,6 @@ width = 500 # subscription list [http://torrez.us/who#elias] content_type = foaf -online_accounts = http://del.icio.us/|http://del.icio.us/rss/{foaf:accountName} - http://flickr.com/|http://api.flickr.com/services/feeds/photos_public.gne?id={foaf:accountName} +online_accounts = + http://del.icio.us/|http://del.icio.us/rss/{foaf:accountName} + http://flickr.com/|http://api.flickr.com/services/feeds/photos_public.gne?id={foaf:accountName} diff --git a/planet/config.py b/planet/config.py index a65cd28..312c1f0 100644 --- a/planet/config.py +++ b/planet/config.py @@ -12,7 +12,7 @@ Usage: # administrative / structural information print config.template_files() - print config.feeds() + print config.subscriptions() # planet wide configuration print config.name() diff --git a/tests/data/config/eliast.foaf b/tests/data/config/eliast.foaf new file mode 100644 index 0000000..a9e2f7a --- /dev/null +++ b/tests/data/config/eliast.foaf @@ -0,0 +1,178 @@ + + + + + + + Elias Torres + Elias + Torres + EliasT + 171e69034f0c1563ed13d66d4abaa8b5d70e4e57 + + + + + rico811 + elias_torres@hotmail.com + + + + Dan Smith + + bd4506f3e280442e626b7123d65dc6d7af348906 + + + + + Lee Feigenbaum + + 15b51eca0082d66bee850ce4774ff2d9921c1f08 + + + + + + Dan Connolly + + + + + + + + + + James Snell + + + + + + + Sam Ruby + 703471c6f39094d88665d24ce72c42fdc5f20585 + + + + + Mark Pilgrim + 85d089d9dc87139d5542aa4ee2822bf65e56b55e + + + + + Eric Miller + fd1c7fa497930b8b24e3998927fcebe63509ef20 + + + + + + + Libby Miller + 80f78952ba7c71bc9a0a38de415692922a3f6024 + 289d4d44325d0b0218edc856c8c3904fa3fd2875 + + + + + Dave Beckett + 970987f991961f2553a1bf2574166fa29befbccb + + + + + + Kendall Grant Clark + + + + + + + + Bijan Parsia + f49a6854842c5fa76dc0edb8e82f8fe04fd56bc9 + + + + + + + + + + + + + + + + + + + + + + + + + + Elias Torres + + + + + + + + + + + + + + eliast + + + + + + 77366516@N00 + + + + + + + + + + + diff --git a/tests/data/config/foaf.ini b/tests/data/config/foaf.ini new file mode 100644 index 0000000..db7a7fb --- /dev/null +++ b/tests/data/config/foaf.ini @@ -0,0 +1,10 @@ +[Planet] +name = FOAF Test Configuration +cache_directory = tests/work/config/cache + +[tests/data/config/eliast.foaf] +content_type = foaf +online_accounts = + http://del.icio.us/|http://del.icio.us/rss/{foaf:accountName} + http://flickr.com/|http://api.flickr.com/services/feeds/photos_public.gne?id={foaf:accountName} + diff --git a/tests/data/config/rlist.ini b/tests/data/config/rlist.ini index 595f0c6..4d1ed03 100644 --- a/tests/data/config/rlist.ini +++ b/tests/data/config/rlist.ini @@ -1,6 +1,5 @@ [Planet] -name = Test Configuration -output_theme = asf +name = OPML Test Configuration cache_directory = tests/work/config/cache [tests/data/config/opml.xml] diff --git a/tests/test_foaf.py b/tests/test_foaf.py index 22eaedb..adc2022 100644 --- a/tests/test_foaf.py +++ b/tests/test_foaf.py @@ -1,8 +1,11 @@ #!/usr/bin/env python -import unittest +import unittest, os, shutil from planet.foaf import foaf2config from ConfigParser import ConfigParser +from planet import config + +workdir = 'tests/work/config/cache' blogroll = 'http://journal.dajobe.org/journal/2003/07/semblogs/bloggers.rdf' testfeed = "http://dannyayers.com/feed/rdf" @@ -45,6 +48,11 @@ class FoafTest(unittest.TestCase): self.config = ConfigParser() self.config.add_section(blogroll) + def tearDown(self): + if os.path.exists(workdir): + shutil.rmtree(workdir) + os.removedirs(os.path.split(workdir)[0]) + # # Tests # @@ -74,6 +82,15 @@ class FoafTest(unittest.TestCase): foaf2config(test, self.config) self.assertEqual('Danny Ayers', self.config.get(testfeed, 'name')) + def test_online_accounts(self): + config.load('tests/data/config/foaf.ini') + feeds = config.subscriptions() + feeds.sort() + self.assertEqual(['http://api.flickr.com/services/feeds/' + + 'photos_public.gne?id=77366516@N00', + 'http://del.icio.us/rss/eliast', + 'http://torrez.us/feed/rdf'], feeds) + # these tests only make sense if libRDF is installed try: import RDF