예제 #1
0
 def test_to_aws_format(self):
     expected_output = [{"ParameterKey": "PARAMETER1",
                         "ParameterValue": "VALUE1"},
                        {"ParameterKey": "PARAMETER2",
                         "ParameterValue": "VALUE2"}]
     sup = StackUpdateParameter(self.input_message)
     self.assertEqual(sup.to_aws_format(), expected_output)
예제 #2
0
 def test_init(self):
     sup = StackUpdateParameter(self.input_message)
     self.assertEqual(sup.version, 1)
     self.assertEqual(sup.stack_name, "ANY_STACK")
     self.assertEqual(sup.region, "ANY_REGION")
     self.assertEqual(sup.items(), [
         ("PARAMETER1", "VALUE1"),
         ("PARAMETER2", "VALUE2")])
예제 #3
0
    def test_merge_many_parameters(self):
        """
        Test that merging with many parameters work.
        """
        sup = StackUpdateParameter({
            'parameters': {
                'param1': 'value1change',
                'param2': 'value2-no-change',
                'param3': 'value3change',
                'paramx': 'value-x-not-existing'},
            'version': 1,
            'stackName': 'bla',
            'region': 'eu-west-1'})

        original_parameters = [{
            'ParameterKey': 'param1',
            'ParameterValue': 'value1-to-be-changed'
        }, {
            'ParameterKey': 'param2',
            'ParameterValue': 'value2-no-change'
        }, {
            'ParameterKey': 'param3',
            'ParameterValue': 'value3-to-be-changed'
        }, {
            'ParameterKey': 'param4',
            'ParameterValue': 'value4-not-updated'
        }]

        expected_output = [{
            'ParameterKey': 'param3',
            'ParameterValue': 'value3change'
        }, {
            'ParameterKey': 'param1',
            'ParameterValue': 'value1change'
        }, {
            'ParameterKey': 'param2',
            'UsePreviousValue': True
        }, {
            'ParameterKey': 'param4',
            'UsePreviousValue': True
        }]
        result = sup.merge(original_parameters)

        self.assertItemsEqual(result, expected_output)
예제 #4
0
 def test_merge(self):
     input_message = {
         "version": 1,
         "stackName": "ANY_STACK",
         "region": "ANY_REGION",
         "parameters": {
             "PARAMETER2": "UPDATED_VALUE2",
         }
     }
     expected_output = [{"ParameterKey": "PARAMETER2",
                         "ParameterValue": "UPDATED_VALUE2"},
                        {"ParameterKey": "PARAMETER1",
                         "UsePreviousValue": True}]
     stack_parameter = [{"ParameterKey": "PARAMETER1",
                         "ParameterValue": "VALUE1"},
                        {"ParameterKey": "PARAMETER2",
                         "ParameterValue": "VALUE2"}]
     sup = StackUpdateParameter(input_message)
     self.assertEqual(sup.merge(stack_parameter), expected_output)