Merge "Use yaml.safe_load instead of yaml.load"

This commit is contained in:
Zuul 2021-09-02 02:27:46 +00:00 committed by Gerrit Code Review
commit 983f0abc58
2 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ class TestCLIFormatter(base.ClientTestBase):
result = self._create_net('yaml', ['name', 'admin_state_up'])
self.assertDictEqual({'name': self.net_name,
'admin_state_up': True},
yaml.load(result))
yaml.safe_load(result))
def test_net_create_with_value_formatter(self):
# NOTE(amotoki): In 'value' formatter, there is no guarantee

View File

@ -1159,7 +1159,7 @@ class CLITestV20OutputFormatter(CLITestV20Base):
def test_create_resource_yaml(self):
self._test_create_resource_with_formatter('yaml')
data = yaml.load(self.fake_stdout.make_string())
data = yaml.safe_load(self.fake_stdout.make_string())
self.assertEqual('myname', data['name'])
self.assertEqual('myid', data['id'])
@ -1184,7 +1184,7 @@ class CLITestV20OutputFormatter(CLITestV20Base):
def test_show_resource_yaml(self):
self._test_show_resource_with_formatter('yaml')
data = yaml.load(''.join(self.fake_stdout.content))
data = yaml.safe_load(''.join(self.fake_stdout.content))
self.assertEqual('myname', data['name'])
self.assertEqual('myid', data['id'])
@ -1211,5 +1211,5 @@ class CLITestV20OutputFormatter(CLITestV20Base):
def test_list_resources_yaml(self):
self._test_list_resources_with_formatter('yaml')
data = yaml.load(''.join(self.fake_stdout.content))
data = yaml.safe_load(''.join(self.fake_stdout.content))
self.assertEqual(['myid1', 'myid2'], [d['id'] for d in data])