³ņ
T ¾Fc           @   sė  d  d k  Z  d  d k Z d  d k Z d  d k l Z l Z l Z d  d k l Z d Z	 d Z
 d Z d e  i f d     YZ d  d k Z x9 e e i  D] Z e i d	  o Pq q We e d
  y d  d k Z Wne j
 oe e d  yh d  d k Z e i d d  \ Z Z e i   e i   y e i   Z Wn e j
 o d  Z n XWn6 d  d k Z e i d  \ Z  Z! e  d ?d @Z n Xe oI e i" d  x9 e e  D]' Z e i d	  o e e e  q³q³Wqēn Xd S(   i’’’’N(   t   configt   splicet   logger(   t   minidoms   tests/work/applys   tests/data/apply/config-%s.inis   tests/data/apply/feed.xmlt	   ApplyTestc           B   sb   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   c         C   s[   t  t  } | i   |  _ | i   y t i t  Wn |  i   t i t  n Xd  S(   N(	   t   opent   testfeedt   readt   feeddatat   closet   ost   makedirst   workdirt   tearDown(   t   selft   testfile(    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   setUp   s    

c         C   s!   t  i t i i t  d  d  S(   Ni    (   t   shutilt   rmtreeR
   t   patht   splitR   (   R   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyR      s    c   	      C   sK  t  i |  i  xk d d d g D]Z } t i i t |  } |  i t i i |   |  i t i	 |  i
 d j | d  q  Wt t i i t d   } t i |  } g  } d } } xb | i d  D]Q } | i d  d j o qČ n | d	 7} | i d
  d j o | d	 7} qČ qČ W| i   |  i d |  |  i d |  d  S(   Ns
   index.htmls   default.csss   images/foaf.pngi    s    has size 0t   divt   classt   contenti   s   xml:langs   en-usi   i   (   R   t   applyR   R
   R   t   joinR   t
   assertTruet   existst   statt   st_sizeR   R   t   parset   getElementsByTagNamet   getAttributeR	   t   assertEqual(	   R   t   fileR   t   htmlt   doct   listR   t   langR   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt	   apply_asf   s$     *
 
(
c         C   s   t  i t d  |  i   d  S(   Nt   asf(   R    t   loadt
   configfileR'   (   R   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_asf0   s    c         C   s   t  i t d  |  i   d  S(   Nt   fancy(   R    R)   R*   t   apply_fancy(   R   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_classic_fancy4   s    c         C   s   t  i t d  |  i   d  S(   Nt   genshi(   R    R)   R*   R-   (   R   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_genshi_fancy8   s    c         C   s   t  i t d  |  i   t t i i t d   i	   } |  i
 | i d  d j  t t i i t d   i	   } |  i
 | i d  d j   d  S(   NR#   s
   index.htmls   />i    s   index.html4(   R    R)   R*   R'   R   R
   R   R   R   R   R   t   find(   R   t   output(    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_filter_html<   s    
!!c         C   s\   t  i t d  |  i   t t i i t d   i	   } |  i
 | i d  d j  d  S(   Nt   mememes
   index.htmls4   <div class="sidebar"><h2>Memes <a href="memes.atom">i    (   R    R)   R*   R-   R   R
   R   R   R   R   R   R1   (   R   R2   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_filter_mememeF   s    
!c         C   s+  t  i i d d  i   } | i d  | i d  t  i i d d d i |   t i |  i	  xg d d d g D]V } t
 i i t |  } |  i t
 i i |  |  |  i t
 i |  i d	 j  qt Wt t
 i i t d   i   } |  i | i d
  d	 j  |  i | i d  d	 j  d  S(   Nt   Planett   template_filess   rss10.xml.tmpls   rss20.xml.tmplt    s
   index.htmls
   planet.csss   images/jdub.pngi    s   <h1>test planet</h1>s1   <h4><a href="http://example.com/2">Venus</a></h4>(   R    t   parsert   getR   t   removet   setR   R   R   R   R
   R   R   R   R   R   R   R   R   R1   (   R   t	   templatesR"   R   R#   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyR-   M   s     #!c         C   sb   t  i t d  t i |  i  t t i i	 t
 d   i   } |  i | i d  d j  d  S(   Nt   filters
   index.htmls&    href="http://example.com/default.css"i    (   R    R)   R*   R   R   R   R   R
   R   R   R   R   R   R1   (   R   R#   (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyt   test_apply_filterb   s    !(   t   __name__t
   __module__R   R   R'   R+   R.   R0   R3   R5   R-   R?   (    (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pyR      s   							
		t   test_R0   R5   s   xsltproc -Vt   ti   i’   s6   xsltproc is not available => can't test XSLT templates(#   t   unittestR
   R   t   planetR    R   R   t   xml.domR   R   R*   R   t   TestCaseR   t   test_filter_genshit   dirt   GenshiFilterTestst   methodt
   startswitht   delattrt   libxml2t   ImportErrort	   win32pipet   popen4t   stdint   stdoutR	   R   t   exitcodet   IOErrort   commandst   getstatusoutputt
   exitstatusR2   t   warn(    (    (    s-   /home/sgala/newcode/venus/tests/test_apply.pys   <module>   sB   $_ 

 
