def test_generate(self, mock_safe_dump): mock_args = mock.Mock() mock_args.id = 'foo' with mock.patch('deploy.open', mock.mock_open(read_data=test_env), create=True) as mock_open: path = deploy._generate_id_env(mock_args) self.assertEqual('env-foo.yaml', path) mock_safe_dump.assert_called_once_with(test_env_output, mock.ANY, default_flow_style=False)
def test_generate_undercloud_name(self, mock_safe_dump): mock_args = mock.Mock() mock_args.id = 'foo' env = test_env + ' undercloud_name: undercloud\n' env_output = dict(test_env_output) env_output['parameters']['undercloud_name'] = 'undercloud-foo' with mock.patch('deploy.open', mock.mock_open(read_data=env), create=True) as mock_open: path = deploy._generate_id_env(mock_args) self.assertEqual('env-foo.yaml', path) mock_safe_dump.assert_called_once_with(env_output, mock.ANY, default_flow_style=False)