Ñò
ýÉªWc        
   @   s©   d  d k  Z  d  d k Z d  d k l Z d  d k l Z d  d k Z e ƒ  e i d <d  d k l Z d  d k	 l	 Z	 d e f d „  ƒ  YZ
 e d	 j o e  i ƒ  n d S(
   iÿÿÿÿN(   t   parseString(   t   Mockt   SSHCommander(   t   UnittestBase(   t   ReportCategoryConfigurationt   ReportCategoryConfigurationTestc           B   sJ   e  Z d  Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   s   res/report-config.xmls   res/report-config-invalid.xmlc         C   s,   t  i |  ƒ t ƒ  |  _ t i |  i _ d S(   s\          
        fake_module = mock.MagicMock()
        sys.modules['Crypto.Util._counter']=fake_module
        sys.modules['Crypto.Cipher._AES']=fake_module

        setattr(Crypto.Util, '_counter', fake_module) 
        setattr(Crypto.Cipher, '_AES', fake_module) 
        
        win_random=winrandom
        win_random.new=MagicMock()
        N(   R   t   setUpR   t   rccR   t   REPORT_CONFIG_PATHt   filePath(   t   self(    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyR      s    c         C   s   t  i i |  ƒ d  S(   N(   t   unittestt   TestCaset   tearDown(   R
   (    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt   teardown"   s    c         C   sÈ   d } d } d d g } |  i  i | ƒ d  } t t i d ƒ i ƒ  } y t | ƒ } Wn t i	 i
 i j
 o
 } t SX|  i | i d ƒ d i d ƒ | ƒ |  i | i d ƒ d i d ƒ d ƒ d  S(   Ns   Content Reportss   Prepack Reportst   rt   reportCategoryi    t   name(   R   t   updatet   Nonet   fileR   R   t   readR    t   xmlt   parserst   expatt
   ExpatErrort   Falset   assertEqualt   getElementsByTagNamet   getAttributet   assertNotEqual(   R
   t   oldCategoryNamet   newCategoryNamet   datat   domt   ft   err(    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt$   testUpdateReportCategorySuccessfully%   s    &c         C   s=   t  i |  i _ d } d } d d g } |  i i | ƒ } d  S(   Ns   Content Reportss   Prepack Reports(   R   t   REPORT_CONFIG_PATH_INVALIDR   R	   R   (   R
   R   R    R!   t   ret(    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt&   testUpdateReportCategoryFileNotExisted6   s
    c         C   s   d g } |  i  i | ƒ d  S(   Ns   Content Reports(   R   R   (   R
   R!   (    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt)   testUpdateReportCategoryInvalidParameters>   s    	c         C   s    d d  g } |  i i | ƒ d  S(   Ns   Content Reports(   R   R   R   (   R
   R!   (    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt-   testUpdateReportCategoryInvalidParametersNoneB   s    (
   t   __name__t
   __module__R   R&   R   R   R%   R(   R)   R*   (    (    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyR      s   					t   __main__(   R   R   t   xml.dom.minidomR    t   mockR   t   syst   modulesR   R   R   R+   t   main(    (    (    sy   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ReportCategoryConfigurationTest.pyt   <module>   s   8