From 73197f3ae5ec14005c6eb49b710a2e835177f2c3 Mon Sep 17 00:00:00 2001 From: Paul Neumann Date: Sat, 23 Jun 2018 19:02:15 +0200 Subject: [PATCH] Extend unit test for Azure source variable generation Add tests for generation of Azure source variables. Test cases such as overwriting a variable with its default value, overwriting a variable with something different to its default value and add variables not set by default. --- awx/main/tests/unit/test_tasks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index c94c205b86..05eb6393d1 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -1890,6 +1890,10 @@ class TestInventoryUpdateCredentials(TestJobExecution): ) return cred self.instance.get_cloud_credential = get_cred + self.instance.source_vars = { + 'include_powerstate': 'yes', + 'group_by_resource_group': 'no' + } def run_pexpect_side_effect(*args, **kwargs): args, cwd, env, stdout = args @@ -1902,8 +1906,9 @@ class TestInventoryUpdateCredentials(TestJobExecution): config = ConfigParser.ConfigParser() config.read(env['AZURE_INI_PATH']) assert config.get('azure', 'include_powerstate') == 'yes' - assert config.get('azure', 'group_by_resource_group') == 'yes' + assert config.get('azure', 'group_by_resource_group') == 'no' assert config.get('azure', 'group_by_location') == 'yes' + assert 'group_by_security_group' not in config.items('azure') assert config.get('azure', 'group_by_tag') == 'yes' assert config.get('azure', 'locations') == 'north,south,east,west' return ['successful', 0] @@ -1930,6 +1935,11 @@ class TestInventoryUpdateCredentials(TestJobExecution): ) return cred self.instance.get_cloud_credential = get_cred + self.instance.source_vars = { + 'include_powerstate': 'yes', + 'group_by_resource_group': 'no', + 'group_by_security_group': 'no' + } def run_pexpect_side_effect(*args, **kwargs): args, cwd, env, stdout = args @@ -1941,8 +1951,9 @@ class TestInventoryUpdateCredentials(TestJobExecution): config = ConfigParser.ConfigParser() config.read(env['AZURE_INI_PATH']) assert config.get('azure', 'include_powerstate') == 'yes' - assert config.get('azure', 'group_by_resource_group') == 'yes' + assert config.get('azure', 'group_by_resource_group') == 'no' assert config.get('azure', 'group_by_location') == 'yes' + assert config.get('azure', 'group_by_security_group') == 'no' assert config.get('azure', 'group_by_tag') == 'yes' assert 'locations' not in config.items('azure') return ['successful', 0]