ó
ìŠ'Gc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m Z m Z d Z	 d Z
 d Z d j ƒ  Z d	 e  j f d
 „  ƒ  YZ y d  d l Z WnM e j d ƒ x: e j j ƒ  D]% Z e j d ƒ rÄ e e e ƒ qÄ qÄ Wn Xe d k r
e  j ƒ  n  d S(   iÿÿÿÿN(   t   foaf2config(   t   ConfigParser(   t   configt   loggers   tests/work/config/caches?   http://journal.dajobe.org/journal/2003/07/semblogs/bloggers.rdfs   http://dannyayers.com/feed/rdfs¢  
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:rss="http://purl.org/rss/1.0/"
  xmlns:dc="http://purl.org/dc/elements/1.1/">

<foaf:Agent rdf:nodeID="id2245354"> 
<foaf:name>Danny Ayers</foaf:name> 
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> 
<foaf:weblog> 
<foaf:Document rdf:about="http://dannyayers.com/"> 
<dc:title>Raw Blog by Danny Ayers</dc:title> 
<rdfs:seeAlso> 
<rss:channel rdf:about="http://dannyayers.com/feed/rdf"> 
<foaf:maker rdf:nodeID="id2245354"/> 
<foaf:topic rdf:resource="http://www.w3.org/2001/sw/"/> 
<foaf:topic rdf:resource="http://www.w3.org/RDF/"/> 
</rss:channel> 
</rdfs:seeAlso> 
</foaf:Document> 
</foaf:weblog> 
<foaf:interest rdf:resource="http://www.w3.org/2001/sw/"/> 
<foaf:interest rdf:resource="http://www.w3.org/RDF/"/> 
</foaf:Agent> 

</rdf:RDF> 
t   FoafTestc           B   sh   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z RS(   s'   
    Test the foaf2config function
    c         C   s    t  ƒ  |  _ |  j j t ƒ d  S(   N(   R   R   t   add_sectiont   blogroll(   t   self(    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   setUp/   s    c         C   sC   t  j j t ƒ r? t j t ƒ t  j t  j j t ƒ d ƒ n  d  S(   Ni    (   t   ost   patht   existst   workdirt   shutilt   rmtreet
   removedirst   split(   R   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   tearDown3   s    c         C   s3   t  t |  j ƒ |  j d |  j j t d ƒ ƒ d  S(   Ns   Danny Ayerst   name(   R    t   test_foaf_documentR   t   assertEqualt   gett   testfeed(   R   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyR   <   s    c         C   sE   t  j d d ƒ } t | |  j ƒ |  j d |  j j t d ƒ ƒ d  S(   Ns	   foaf:names
   foaf:titles   Raw Blog by Danny AyersR   (   R   t   replaceR    R   R   R   R   (   R   t   test(    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_no_foaf_name@   s    	c         C   s?   t  j d d ƒ } t | |  j ƒ |  j |  j j t ƒ ƒ d  S(   Ns   rdfs:seeAlsos   rdfs:seealso(   R   R   R    R   t   assertFalset   has_sectionR   (   R   R   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_no_weblogF   s    c         C   s7   d t  } t | |  j ƒ |  j |  j j t ƒ ƒ d  S(   Ns'   
<?xml version="1.0" encoding="UTF-8"?>(   R   R    R   R   R   R   (   R   R   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_invalid_xml_beforeK   s    
c         C   sC   t  j ƒ  d  } t | |  j ƒ |  j d |  j j t d ƒ ƒ d  S(   Niÿÿÿÿs   Danny AyersR   (   R   t   stripR    R   R   R   R   (   R   R   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_invalid_xml_afterP   s    c         C   sD   t  j d ƒ t  j ƒ  } | j ƒ  |  j d d d d g | ƒ d  S(   Ns   tests/data/config/foaf.inis%   http://api.flickr.com/services/feeds/s!   photos_public.gne?id=77366516@N00s   http://del.icio.us/rss/eliasts   http://torrez.us/feed/rdf(   R   t   loadt   subscriptionst   sortR   (   R   t   feeds(    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_online_accountsU   s    
	c         C   s€   t  j d ƒ |  j d t t  j ƒ  ƒ ƒ t  j ƒ  } | j ƒ  |  j d t | ƒ ƒ |  j d d d d d d d	 g | ƒ d  S(
   Ns#   tests/data/config/foaf-multiple.inii   i   s%   http://api.flickr.com/services/feeds/s!   photos_public.gne?id=77366516@N00s   photos_public.gne?id=SOMEIDs   http://del.icio.us/rss/SOMEIDs   http://del.icio.us/rss/eliasts   http://torrez.us/feed/rdf(   R   R    R   t   lent   reading_listsR!   R"   (   R   R#   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_multiple_subscriptions^   s    
	c         C   sL   t  j d ƒ t  j ƒ  } | j ƒ  |  j d d d d d d d g | ƒ d  S(	   Ns   tests/data/config/foaf-deep.inisF   http://api.flickr.com/services/feeds/photos_public.gne?id=77366516@N00s   http://del.icio.us/rss/eliasts   http://del.icio.us/rss/leefs   http://del.icio.us/rss/rubyss%   http://intertwingly.net/blog/atom.xmls(   http://thefigtrees.net/lee/life/atom.xmls   http://torrez.us/feed/rdf(   R   R    R!   R"   R   (   R   R#   (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   test_recursivel   s    
	(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R$   R'   R(   (    (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyR   *   s   											s=   Redland RDF is not available => can't test FOAF reading listst   test_t   __main__(   t   unittestR	   R   t   planet.foafR    R   t   planetR   R   R   R   R   R   R   t   TestCaseR   t   RDFt   warnt   __dict__t   keyst   keyt
   startswitht   delattrR)   t   main(    (    (    s@   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_foaf.pyt   <module>   s"   $M 