configurationengine/source/scripts/tests/unittest_info.py
author terytkon
Thu, 11 Mar 2010 17:04:37 +0200
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
permissions -rw-r--r--
Adding EPL version of configurationengine.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     1
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     2
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     3
# All rights reserved.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     4
# This component and the accompanying materials are made available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     6
# which accompanies this distribution, and is available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     8
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     9
# Initial Contributors:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    11
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    12
# Contributors:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    13
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    14
# Description: 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    15
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    16
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    17
"""
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    18
Test the configuration
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    19
"""
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    20
import unittest
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    21
import string
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    22
import sys
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    23
import os
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    24
import subprocess
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    25
import __init__
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    26
from testautomation.base_testcase import BaseTestCase
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    27
from scripttest_common import get_cmd
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    28
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    29
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    30
testproject = os.path.join(ROOT_PATH,'test_project.cpf')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    31
temp_dir    = os.path.join(ROOT_PATH, 'temp/info')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    32
VALUE_REPORT_PROJECT = os.path.join(ROOT_PATH, 'testdata/info/value_report_project')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    33
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    34
class TestInfo(BaseTestCase):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    35
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    36
    def test_get_help(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    37
        cmd = '%s -h' % get_cmd('info')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    38
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    39
        lines = out.split('\r\n')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    40
        self.assertTrue('Options:' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    41
        self.assertTrue('  Info options:' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    42
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    43
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    44
    def test_get_project_info(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    45
        self.set_modification_reference_time(testproject)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    46
        cmd = '%s -p "%s"' % (get_cmd('info'), testproject)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    47
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
        lines = out.split('\r\n')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
        self.assertTrue('Configurations in the project.' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
        self.assertTrue('root1.confml' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
        self.assertTrue('root2.confml' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
        self.assertTrue('root3.confml' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
        self.assertTrue('root4.confml' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
        self.assertTrue('root5.confml' in lines)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
        self.assert_not_modified(testproject)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
    def test_api_report(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/api_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
        REPORT_FILE = os.path.join(temp_dir, 'api_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
        cmd = '%s -p "%s" -c root3.confml --report-type api --report "%s"' % (get_cmd('info'), testproject, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
        # Ignore the file links, because their value depends on the current directory
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
        ignores= [r'<td><a href="file://.*">.*</a></td>']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE, ignores)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
    def test_impl_report(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/impl_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
        REPORT_FILE = os.path.join(temp_dir, 'impl_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
        cmd = '%s -p "%s" -c root3.confml --report-type impl --report "%s"' % (get_cmd('info'), testproject, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    76
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    79
    def test_impl_report_with_impl_containers(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    80
        PROJECT = os.path.join(ROOT_PATH, 'generation_test_project')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    81
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/impl_report_with_containers.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    82
        REPORT_FILE = os.path.join(temp_dir, 'impl_report_with_containers.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    83
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    84
        cmd = '%s -p "%s" -c root.confml --report-type impl --report "%s"' % (get_cmd('info'), PROJECT, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    85
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    86
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    87
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    88
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    89
    def test_content_report(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    90
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/content_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    91
        REPORT_FILE = os.path.join(temp_dir, 'content_report.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    92
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    93
        cmd = '%s -p "%s" -c root5.confml --report-type content --report "%s"' % (get_cmd('info'), testproject, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    94
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    95
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    96
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    97
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    98
    # --------------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    99
    # Tests for invalid configuration argument detection
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   100
    # --------------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   101
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   102
    def _run_test_invalid_configuration_args(self, config_args, expected_msg):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   103
        REPORT_FILE = os.path.join(temp_dir, "dummy_report.html")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   104
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   105
        cmd = '%s -p "%s" %s --report "%s"' \
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   106
            % (get_cmd('info'), VALUE_REPORT_PROJECT, config_args, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   107
        # Note: The following run_command() should really expect the
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   108
        #       return code 2, but for some reason when running from the
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   109
        #       standalone test set, the return value is 0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   110
        out = self.run_command(cmd, expected_return_code = None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   111
        self.assertFalse(os.path.exists(REPORT_FILE))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   112
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   113
        self.assertTrue(expected_msg in out,
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   114
                        "Expected message '%s' not in output ('%s')" % (expected_msg, out))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   115
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   116
    def test_invalid_single_configuration(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   117
        self._run_test_invalid_configuration_args(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   118
            '--configuration nonexistent_root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   119
            "No such configuration: nonexistent_root.confml")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   120
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   121
    def test_invalid_multi_configuration(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   122
        self._run_test_invalid_configuration_args(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   123
            '--configuration product_root.confml --configuration nonexistent_root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   124
            "No such configuration: nonexistent_root.confml")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   125
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   126
    def test_invalid_wildcard_configuration(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   127
        self._run_test_invalid_configuration_args(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   128
            '--config-wildcard nonexistent*.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   129
            "No matching configurations for wildcard(s) and/or pattern(s).")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   130
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   131
    def test_invalid_regex_configuration(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   132
        self._run_test_invalid_configuration_args(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   133
            '--config-regex nonexistent.*\\.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   134
            "No matching configurations for wildcard(s) and/or pattern(s).")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   135
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   136
    def test_invalid_view_file(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   137
        self._run_test_invalid_configuration_args(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   138
            '-c product_root.confml --view-file nonexistent.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   139
            "No such file: nonexistent.confml")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   140
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   141
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   142
    # ----------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   143
    # Tests for value report
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   144
    # ----------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   145
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   146
    def _run_test_value_report(self, output, expected, args, rep_type='value'):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   147
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/%s' % expected)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   148
        REPORT_FILE = os.path.join(temp_dir, output)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   149
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   150
        cmd = '%s -p "%s" %s --report-type %s --report "%s"' \
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   151
            % (get_cmd('info'), VALUE_REPORT_PROJECT, args, rep_type, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   152
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   153
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   154
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   155
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   156
    def test_value_report_configs_with_wildcard(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   157
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   158
            output   = 'value_report_langpacks_wildcard.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   159
            expected = 'value_report_langpacks.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   160
            args     = '--config-wildcard product_langpack_*_root.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   161
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   162
    def test_value_report_configs_with_regex(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   163
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   164
            output   = 'value_report_langpacks_regex.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   165
            expected = 'value_report_langpacks.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   166
            args     = '--config-regex product_langpack_\\d{2}_root.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   167
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   168
    def test_value_report_multi_config(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   169
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   170
            output   = 'value_report_langpacks_regex.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   171
            expected = 'value_report_langpacks.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   172
            args     = '-c product_langpack_01_root.confml '\
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   173
                       '-c product_langpack_02_root.confml '\
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   174
                       '-c product_langpack_03_root.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   175
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   176
    def test_value_report_single_config(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   177
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   178
            output   = 'value_report_single.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   179
            expected = 'value_report_single.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   180
            args     = '--configuration product_root.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   181
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   182
    def test_value_report_multi_config_mixed_args(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   183
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   184
            output   = 'value_report_multi_mixed.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   185
            expected = 'value_report_multi_mixed.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   186
            args     = '-c product_root.confml --config-wildcard product_langpack_*_root.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   187
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   188
    def test_value_report_single_config_with_view(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   189
        VIEW_FILE = os.path.join(ROOT_PATH, 'testdata/info/test_view.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   190
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   191
            output   = 'value_report_single_with_view.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   192
            expected = 'value_report_single_with_view.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   193
            args     = '--configuration product_root.confml --view-file "%s"' % VIEW_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   194
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   195
    def test_value_report_single_config_with_included_view(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   196
        VIEW_FILE = os.path.join(ROOT_PATH, 'testdata/info/include_test_view.confml')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   197
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   198
            output   = 'value_report_single_with_included_view.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   199
            expected = 'value_report_single_with_view.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   200
            args     = '--configuration product_root.confml --view-file "%s"' % VIEW_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   201
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   202
    def test_value_report_csv(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   203
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   204
            output   = 'value_report.csv',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   205
            expected = 'value_report.csv',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   206
            args     = '--config-wildcard product_langpack_*_root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   207
            rep_type = 'value_csv')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   208
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   209
    def test_value_report_csv_with_special_chars(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   210
        self._run_test_value_report(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   211
            output   = 'value_report_special_chars.csv',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   212
            expected = 'value_report_special_chars.csv',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   213
            args     = '--configuration csv_test_root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   214
            rep_type = 'value_csv')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   215
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   216
    def test_value_report_custom_template(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   217
        TEMPLATE_FILE = os.path.join(ROOT_PATH, 'testdata/info/custom_value_report_template.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   218
        EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/value_report_custom.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   219
        REPORT_FILE = os.path.join(temp_dir, 'value_report_custom.html')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   220
        self.remove_if_exists(REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   221
        cmd = '%s -p "%s" --template "%s" --report "%s" -c product_root.confml' \
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   222
            % (get_cmd('info'), VALUE_REPORT_PROJECT, TEMPLATE_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   223
        out = self.run_command(cmd)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   224
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   225
        self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   226
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   227
if __name__ == '__main__':
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   228
      unittest.main()