buildframework/helium/tools/common/python/lib/cpythontest/test_vbaconf.py
changeset 179 d8ac696cc51f
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
       
     1 #============================================================================ 
       
     2 #Name        : test_vbaconf.py 
       
     3 #Part of     : Helium 
       
     4 
       
     5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 #All rights reserved.
       
     7 #This component and the accompanying materials are made available
       
     8 #under the terms of the License "Eclipse Public License v1.0"
       
     9 #which accompanies this distribution, and is available
       
    10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 #
       
    12 #Initial Contributors:
       
    13 #Nokia Corporation - initial contribution.
       
    14 #
       
    15 #Contributors:
       
    16 #
       
    17 #Description:
       
    18 #===============================================================================
       
    19 
       
    20 """ Some test cases for VBA config generation.
       
    21 """
       
    22 import unittest
       
    23 import logging
       
    24 import os
       
    25 import vbaconf
       
    26 import vbaconf.new_delivery
       
    27 import amara
       
    28 
       
    29 # Uncomment this line to enable logging in this module, or configure logging elsewhere
       
    30 #logging.basicConfig(level=logging.DEBUG)
       
    31 logger = logging.getLogger('test.vbaconf')
       
    32 
       
    33 
       
    34 class TestVBAConf(unittest.TestCase):
       
    35     """ Implementation of VBA test cases. """
       
    36     
       
    37     def test_vba_conf_generation(self):
       
    38         """ Testing all methods from VBA config generation.
       
    39         """
       
    40         delivery = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/delivery.xml.parsed')
       
    41         prep = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/prep.xml.parsed')
       
    42         doc = vbaconf.generate_config(delivery, prep)
       
    43         
       
    44         logger.info(doc.toprettyxml())
       
    45         
       
    46         doc = amara.parse(str(doc.toprettyxml()))
       
    47         assert len(doc.xml_xpath("/virtualBuildArea/add")) == 24 
       
    48         
       
    49     def test_vba_conf_generation_new_delivery_format(self):
       
    50         """ Testing all methods from VBA config generation.
       
    51         """
       
    52         delivery = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/new_delivery/delivery.xml.parsed')
       
    53         prep = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/new_delivery/prep.xml.parsed')
       
    54         doc = vbaconf.new_delivery.generate_config(delivery, prep)
       
    55         
       
    56         logger.info(doc.toprettyxml())
       
    57         
       
    58         doc = amara.parse(str(doc.toprettyxml()))
       
    59         ##assert len(doc.xml_xpath("/virtualBuildArea/add")) == 24 
       
    60         
       
    61     def test_vba_conf_generation_new_api(self):
       
    62         """ Testing all methods from VBA config generation.
       
    63         """
       
    64         delivery = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/delivery.xml.parsed')
       
    65         prep = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/prep.xml.parsed')
       
    66         conv = vbaconf.ConfigConverter(delivery, prep)
       
    67         doc = conv.generate_config()
       
    68         
       
    69         logger.info(doc.toprettyxml())
       
    70         
       
    71         doc = amara.parse(str(doc.toprettyxml()))
       
    72         assert len(doc.xml_xpath("/virtualBuildArea/add")) == 24 
       
    73 
       
    74     def test_vba_conf_generation_new_api_new_delivery_format(self):
       
    75         """ Testing all methods from VBA config generation.
       
    76         """
       
    77         delivery = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/new_delivery/delivery.xml.parsed')
       
    78         prep = os.path.join(os.environ['HELIUM_HOME'],'tests/data/validate_overlay/new_delivery/prep.xml.parsed')
       
    79         conv = vbaconf.ConfigConverterNewDelivery(delivery, prep)
       
    80         doc = conv.generate_config()
       
    81         
       
    82         logger.info(doc.toprettyxml())
       
    83         
       
    84         doc = amara.parse(str(doc.toprettyxml()))
       
    85         assert len(doc.xml_xpath("/virtualBuildArea/add")) == 24 
       
    86 
       
    87