def test_missing_params_no_existing_stack(self): """Test missing params no existing stack.""" all_params = ["Address", "StackName"] required = ["Address"] parameter_values = {} with self.assertRaises(exceptions.MissingParameterException) as result: _handle_missing_parameters(parameter_values, all_params, required) self.assertEqual(result.exception.parameters, required)
def test_existing_stack_params_does_not_override_given_params(self): """Test existing stack params does not override given params.""" existing_stack_param_dict = { "StackName": "teststack", "Address": "192.168.0.1" } existing_stack_params = mock_stack_parameters( existing_stack_param_dict) all_params = existing_stack_param_dict.keys() required = ["Address"] parameter_values = {"Address": "10.0.0.1"} result = _handle_missing_parameters(parameter_values, all_params, required, existing_stack_params) self.assertEqual(sorted(result), sorted(list(parameter_values.items())))
def test_handle_missing_params(self): """Test handle missing params.""" existing_stack_param_dict = { "StackName": "teststack", "Address": "192.168.0.1" } existing_stack_params = mock_stack_parameters( existing_stack_param_dict ) all_params = existing_stack_param_dict.keys() required = ["Address"] parameter_values = {"Address": "192.168.0.1"} expected_params = {"StackName": UsePreviousParameterValue, "Address": "192.168.0.1"} result = _handle_missing_parameters(parameter_values, all_params, required, existing_stack_params) self.assertEqual(sorted(result), sorted(list(expected_params.items())))