summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/heat/tests/generate_template_test.py
diff options
context:
space:
mode:
authoryuyang <Gabriel.yuyang@huawei.com>2017-02-20 11:28:17 +0800
committeryuyang <Gabriel.yuyang@huawei.com>2017-03-09 19:54:56 +0800
commitc5162f01bb54eab6b3c4056074e28e0080dc4d08 (patch)
tree62c3c6b08fd54e25deb22949a009bc7ce3ac9612 /utils/infra_setup/heat/tests/generate_template_test.py
parent5938133db9d2a4a8796c45eeeeef2c74da3ddeba (diff)
Add liscense to file headers
JIRA: BOTTLENECK-133 Some Yaml, XML and __init__.py file do not have liscense headers. This patch is to add headers to those files or delete those are deprecated. Change-Id: Ie059b1f1879eb420eec171f96985247510c74642 Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'utils/infra_setup/heat/tests/generate_template_test.py')
-rwxr-xr-xutils/infra_setup/heat/tests/generate_template_test.py83
1 files changed, 0 insertions, 83 deletions
diff --git a/utils/infra_setup/heat/tests/generate_template_test.py b/utils/infra_setup/heat/tests/generate_template_test.py
deleted file mode 100755
index 374ca30e..00000000
--- a/utils/infra_setup/heat/tests/generate_template_test.py
+++ /dev/null
@@ -1,83 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import template
-import common
-import os
-import unittest
-import mock
-
-import sys
-sys.path.append("..")
-
-
-def reset_common():
- common.LOG = None
- common.CONF_FILE = None
- common.DEPLOYMENT_UNIT = None
- common.ITERATIONS = None
- common.BASE_DIR = None
- common.TEMPLATE_DIR = None
- common.TEMPLATE_NAME = None
- common.TEMPLATE_EXTENSION = None
-
-
-class TestGeneratesTemplate(unittest.TestCase):
-
- def setUp(self):
- self.deployment_configuration = {
- 'flavor': ['medium']
- }
- self.template_name = 'rubbos_1-1-1_template.tmp'
- # common.init()
-
- def tearDown(self):
- reset_common()
-
- @mock.patch('common.LOG')
- @mock.patch('common.get_template_dir')
- def test_generates_template_for_success(self, mock_template_dir,
- mock_log):
- tmp_generated_templates_dir = '/data/generated_templates/'
- generated_templates_dir = "{}{}".format(
- os.getcwd(), tmp_generated_templates_dir)
- mock_template_dir.return_value = generated_templates_dir
- tmp_test_templates = '/data/test_templates/'
- test_templates = "{}{}".format(os.getcwd(), tmp_test_templates)
- template.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- t_name = '/data/generated_templates/rubbos_1-1-1_template.tmp'
- self.template_name = "{}{}".format(os.getcwd(), t_name)
- template.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- @mock.patch('common.get_template_dir')
- def test_get_all_heat_templates_for_success(self, template_dir):
- tmp_generated_templates = '/data/generated_templates/'
- generated_templates = "{}{}".format(
- os.getcwd(), tmp_generated_templates)
- template_dir.return_value = generated_templates
- extension = '.yaml'
- expected = ['test_template_1.yaml']
- result = template.get_all_heat_templates(generated_templates,
- extension)
- self.assertListEqual(expected, result)