ó
ìŠ'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 e j
 ƒ  d d Z d Z d	 e  j f d
 „  ƒ  YZ d S(   iÿÿÿÿN(   t   deepcopy(   t   scrub(   t
   feedparsert   configs#  
<feed xmlns='http://www.w3.org/2005/Atom' xml:base="http://example.com/">
  <author><name>F&amp;ouml;o</name></author>
  <entry xml:lang="en">
    <id>ignoreme</id>
    <author><name>F&amp;ouml;o</name></author>
    <updated>%d-12-31T23:59:59Z</updated>
    <title>F&amp;ouml;o</title>
    <summary>F&amp;ouml;o</summary>
    <content>F&amp;ouml;o</content>
    <link href="http://example.com/entry/1/"/>
    <source>
      <link href="http://example.com/feed/"/>
      <author><name>F&amp;ouml;o</name></author>
    </source>
  </entry>
</feed>
i    i   sz   
[testfeed]
ignore_in_feed = 
future_dates = 

name_type = html
title_type = html
summary_type = html
content_type = html
t	   ScrubTestc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s½  t  j t ƒ } |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j j d ƒ ƒ t j j	 t
 j
 t ƒ ƒ t j j d d	 d
 ƒ t | ƒ } t d | ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j d ƒ ƒ |  j | j d j j d ƒ ƒ d  S(   Ni    t   authort   author_detailt   idt   updatedt   updated_parsedt   languaget   testfeedt   ignore_in_feeds   author id updated xml:lang(   R   t   parset   feedt
   assertTruet   entriest   has_keyt   summary_detailR   t   parsert   readfpt   StringIOt
   configDatat   setR    R   t   assertFalse(   t   selft   baset   data(    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyt   test_scrub_ignore(   s$     c         C   s  t  j t ƒ } |  j d | j j j ƒ t j j t	 j	 t
 ƒ ƒ t | ƒ } t d | ƒ |  j d | j j j ƒ |  j d | j d j j ƒ |  j d | j d j j j ƒ |  j d | j d j j ƒ |  j d | j d j j ƒ |  j d | j d j d j ƒ d  S(   Ns   F&ouml;oR   s   FÃ¶oi    s	   text/html(   R   R   R   t   assertEqualR   t   nameR   R   R   R   R   R    R   R   t   sourcet   title_detailt   typeR   t   content(   R   R   R   (    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyt   test_scrub_type?   s     c         C   sö   t  j t ƒ } |  j d t | j ƒ ƒ |  j | j d j d ƒ ƒ t j	 j
 t j t ƒ ƒ t j	 j d d d ƒ t | ƒ } t d | ƒ |  j | j d j d ƒ ƒ t j	 j d d d ƒ t | ƒ } t d | ƒ |  j d t | j ƒ ƒ d  S(   Ni   i    R   R   t   future_datest   ignore_datet   ignore_entry(   R   R   R   R   t   lenR   R   R   R   R   R   R   R   R   R    R   R   (   R   R   R   (    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyt   test_scrub_futureP   s    c         C   sy  t  j t ƒ } |  j d | j d j j ƒ t j j	 t
 j
 t ƒ ƒ t j j d d d ƒ t | ƒ } t d | ƒ |  j d | j d j j ƒ t j j d d d ƒ t | ƒ } t d | ƒ |  j d | j d j j ƒ t j j d d d	 ƒ t | ƒ } t d | ƒ |  j d
 | j d j j ƒ t j j d d d ƒ t | ƒ } t d | ƒ |  j d | j d j j ƒ d  S(   Ns   http://example.com/i    R   t   xml_baset   feed_alternates   http://example.com/feed/t   entry_alternates   http://example.com/entry/1/s   base/s   http://example.com/base/s   http://example.org/data/(   R   R   R   R   R   R    R   R   R   R   R   R   R   R    R   (   R   R   R   (    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyt   test_scrub_xmlbase`   s0    					(   t   __name__t
   __module__R   R#   R(   R,   (    (    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyR   &   s   			(   t   unittestR   t   timet   copyR    t   planet.scrubR   t   planetR   R   t   gmtimeR   R   t   TestCaseR   (    (    (    sA   /home/sa3ruby/intertwingly.net/code/venus-bzr/tests/test_scrub.pyt   <module>   s   $