Exemple #1
0
    def test_output_mapping(self):
        heat_outputs = [{
            "output_value": "value1",
            "description": "No description given",
            "output_key": "key1"
        }, {
            "output_value": ["value2", "value3"],
            "description": "No description given",
            "output_key": "key2"
        }]

        mock_stack = mock.MagicMock()
        mock_stack.to_dict.return_value = {'outputs': heat_outputs}

        output = tdef.OutputMapping('key1')
        value = output.get_output_value(mock_stack)
        self.assertEqual('value1', value)

        output = tdef.OutputMapping('key2')
        value = output.get_output_value(mock_stack)
        self.assertEqual(["value2", "value3"], value)

        output = tdef.OutputMapping('key3')
        value = output.get_output_value(mock_stack)
        self.assertIsNone(value)

        # verify stack with no 'outputs' attribute
        mock_stack.to_dict.return_value = {}
        output = tdef.OutputMapping('key1')
        value = output.get_output_value(mock_stack)
        self.assertIsNone(value)
Exemple #2
0
    def test_output_mapping(self):
        heat_outputs = [{
            "output_value": "value1",
            "description": "No description given",
            "output_key": "key1"
        }, {
            "output_value": ["value2", "value3"],
            "description": "No description given",
            "output_key": "key2"
        }]

        mock_stack = mock.MagicMock()
        mock_stack.outputs = heat_outputs

        output = tdef.OutputMapping('key1')
        value = output.get_output_value(mock_stack)
        self.assertEqual(value, 'value1')

        output = tdef.OutputMapping('key2')
        value = output.get_output_value(mock_stack)
        self.assertEqual(value, ["value2", "value3"])

        output = tdef.OutputMapping('key3')
        value = output.get_output_value(mock_stack)
        self.assertIsNone(value)