Ñò
ýÉªWc        	   @   s   d  d k  Z  d  d k Z d  d k i i Z d  d k l Z 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   ContentClassAssembler(   t   DefinintionAssembler(   t   UnittestBaset   ContentClassAssemblerTestc           B   sV   e  Z d  „  Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   s   t  i |  ƒ t ƒ  |  _ d  S(   N(   R   t   setUpR    t	   assembler(   t   self(    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyR      s    c         C   s8   | d j o' | d j o
 d } n t | ƒ ‚ n d S(   s(   Included for symmetry with assertIsNone.s   test failureN(   t   Nonet   RuntimeError(   R   t   objt   msg(    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   assertIsNotNone   s    
c         C   s8   | d j	 o' | d j o
 d } n t | ƒ ‚ n d S(   sC   Same as self.assertTrue(obj is None), with a nicer default message.s   test failureN(   R   R   (   R   R	   R
   (    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   assertIsNone#   s    
c         C   sH   | i  | ƒ } | o. x+ | D] } | i | | j o | Sq Wn d  S(   N(   t   findallt   attrib(   R   t   nodeElementt   patht   arrnamet   arrvaluet   nodest   n(    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   getElementWithAttrFilter+   s     c         C   sf  d } |  i  i d ƒ |  i  i d ƒ |  i  i | ƒ t i | ƒ } |  i |  i | i ƒ  d d d ƒ ƒ |  i | i ƒ  d d d ƒ } |  i | d d d	 ƒ } |  i | ƒ |  i | i ƒ  d d d ƒ } |  i | d d d
 ƒ } |  i d | i	 d ƒ |  i d | i	 d ƒ t
 i d j oA | i ƒ  i d ƒ } | i d ƒ } |  i t | ƒ d j ƒ n d  S(   Ns$   res/__content_class_merge_result.xmls   res/content_class_base.xmls   res/content_class_merge.xmls   metadata/assetR   t   PACKAGEXXXXXXt   PACKAGEt   fields7   /Fields/CreationInfo/Sources/Source/Contact/AddressXXXXs3   /Fields/ProviderInfo/Identifier/Locator/Descriptiont   truexxxxt   isHiddent   2t   maxi   i   i    sn   metadata/asset[@path="PACKAGE/TITLE"]/field[@path="/Fields/CustomFields/CustomField[@name=CP_Profile]/@value"]s   options/option[value="New"](   i   i   i    (   R   t	   mergeWitht
   write2filet   ETt   parseR   R   t   getroott   assertEqualR   t   syst   version_infot   findR   t
   assertTruet   len(   R   t   resultt   treet   packaget   newFieldR   t   opts(    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   testMergeContentCalsses2   s"    %c         C   s¬  d } |  i  i d ƒ t i d ƒ } |  i |  i | i ƒ  d d d ƒ ƒ t i d j o, | i ƒ  i	 d	 ƒ } |  i
 | d  j	 ƒ n |  i  i d
 ƒ |  i  i | ƒ t i | ƒ } |  i |  i | i ƒ  d d d ƒ ƒ |  i |  i | i ƒ  d d d ƒ ƒ |  i | i ƒ  d d d ƒ } |  i | d d d ƒ } |  i | ƒ |  i | d d d ƒ } |  i | ƒ t i d j o1 | i ƒ  i	 d	 ƒ } |  i
 | d  j ƒ d GHn d  S(   Ns$   res/__content_class_merge_result.xmls   res/content_class_base.xmls   metadata/assetR   s   PACKAGE/MOVIESEGMENTGROUPi   i   i    s   metadata/asset[@path="PACKAGE/TITLE"]/field[@path="/Fields/CustomFields/CustomField[@name=CP_Profile]/@value"]/options/option[value="be_delete"]s   res/content_class_delete.xmls   PACKAGE/TITLENoExistsR   R   s3   /Fields/ProviderInfo/Identifier/Locator/Descriptions;   /Fields/ProviderInfo/Identifier/Locator/DescriptionNoExistss   delete option success(   i   i   i    (   i   i   i    (   R   t   loadDefaultR   R    R   R   R!   R#   R$   R%   R&   R   t   deleteByR   R   (   R   R(   t   org_treeR   R)   R*   R+   (    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   testDeleteContentClassU   s*    %%%c         C   sr  t  d t d t d t ƒ |  _ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d	 ƒ |  i i d
 ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d	 ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ |  i i d ƒ d  S(   Nt   sortTagst   fix_isHidden_fieldt   fix_includeInBatch_fields   res/ContentClasses.AMS.xmls&   res/ContentClasses.Azuki_Mediaroom.xmls   res/ContentClasses.XPMP.xmls#   res/ContentClasses.Default_msmw.xmls    res/ContentClasses.Mediaroom.xmls   res/ContentClasses.OTT.xmls   res/__ContentClasses.FULL.xmls   res/__ContentClasses.AMS.xmls(   res/__ContentClasses.Azuki_Mediaroom.xmls%   res/__ContentClasses.Default_msmw.xmls"   res/__ContentClasses.Mediaroom.xmls   res/__ContentClasses.OTT.xmls   res/definition_default.xmls   res/__definition_default.xmls   res/definition_mwmw.xmls   res/__definition_mwmw.xml(   R    t   TrueR   R   R   R.   (   R   (    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   testFormatXmlƒ   s,    c         C   s4   t  ƒ  } | i d ƒ | i d ƒ | i d ƒ d  S(   Ns   res/definition_mwmw.xmls   res/definition_default.xmls   res/__definition_FULL.xml(   R   R   R   (   R   t   er(    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   testMergeDefinition¥   s    	N(   t   __name__t
   __module__R   R   R   R   R   R-   R1   R6   R8   (    (    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyR      s   			#	.	"t   __main__(   R#   t   unittestt   xml.etree.ElementTreet   etreet   ElementTreeR   t   FileAssemblerR    R   R   R   R9   t   main(    (    (    sk   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/FileAssemblerTest.pyt   <module>   s   —