Remove useless file_name value from test

Value file_name is not used in file and just displayed as message for
assertions, so we may remove it.

Change-Id: Ide597a4da572d5b06ceb05abfff9c62c841afde2
This commit is contained in:
Sergey Kraynev 2015-11-30 04:13:14 -05:00
parent 9e2e459def
commit 6c717fc8a7
1 changed files with 7 additions and 10 deletions

View File

@ -40,10 +40,9 @@ class JsonToYamlTest(common.HeatTestCase):
template_test_count = 0
for (json_str,
yml_str,
file_name) in self.convert_all_json_to_yaml(path):
yml_str) in self.convert_all_json_to_yaml(path):
self.compare_json_vs_yaml(json_str, yml_str, file_name)
self.compare_json_vs_yaml(json_str, yml_str)
template_test_count += 1
if template_test_count >= self.expected_test_count:
break
@ -52,12 +51,11 @@ class JsonToYamlTest(common.HeatTestCase):
'Expected at least %d templates to be tested, not %d' %
(self.expected_test_count, template_test_count))
def compare_json_vs_yaml(self, json_str, yml_str, file_name):
def compare_json_vs_yaml(self, json_str, yml_str):
yml = template_format.parse(yml_str)
self.assertEqual(u'2012-12-12', yml[u'HeatTemplateFormatVersion'],
file_name)
self.assertNotIn(u'AWSTemplateFormatVersion', yml, file_name)
self.assertEqual(u'2012-12-12', yml[u'HeatTemplateFormatVersion'])
self.assertNotIn(u'AWSTemplateFormatVersion', yml)
del(yml[u'HeatTemplateFormatVersion'])
jsn = template_format.parse(json_str)
@ -65,7 +63,7 @@ class JsonToYamlTest(common.HeatTestCase):
if u'AWSTemplateFormatVersion' in jsn:
del(jsn[u'AWSTemplateFormatVersion'])
self.assertEqual(yml, jsn, file_name)
self.assertEqual(yml, jsn)
def convert_all_json_to_yaml(self, dirpath):
for path in os.listdir(dirpath):
@ -73,10 +71,9 @@ class JsonToYamlTest(common.HeatTestCase):
continue
with open(os.path.join(dirpath, path), 'r') as f:
json_str = f.read()
f_name = f.name
yml_str = template_format.convert_json_to_yaml(json_str)
yield (json_str, yml_str, f_name)
yield (json_str, yml_str)
def test_integer_only_keys_get_translated_correctly(self):
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),