Esempio n. 1
0
    def test_configure_empty(self):
        _test_name = 'test_configure'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=PARAMETER_GROUP_TH)
        current_ctx.set(_ctx)

        parameter_group.configure(ctx=_ctx, resource_config=None, iface=None)

        self.assertEqual(_ctx.instance.runtime_properties,
                         RUNTIME_PROPERTIES_AFTER_CREATE)
    def test_configure(self):
        _test_name = 'test_configure'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=PARAMETER_GROUP_TH
        )
        current_ctx.set(_ctx)

        self.fake_client.modify_db_parameter_group = MagicMock(
            return_value={'DBParameterGroupName': 'abc'}
        )
        parameter_group.configure(
            ctx=_ctx, resource_config={
                "Parameters": [
                    {
                        "ParameterName": "time_zone",
                        "ParameterValue": "US/Eastern",
                        "ApplyMethod": "immediate"
                    }, {
                        "ParameterName": "lc_time_names",
                        "ParameterValue": "en_US",
                        "ApplyMethod": "immediate"
                    }
                ]
            }, iface=None
        )

        self.fake_client.modify_db_parameter_group.assert_called_with(
            DBParameterGroupName='dev-db-param-group',
            Parameters=[{
                'ParameterName': 'time_zone',
                'ParameterValue': 'US/Eastern',
                'ApplyMethod': 'immediate'
            }, {
                'ParameterName': 'lc_time_names',
                'ParameterValue': 'en_US',
                'ApplyMethod': 'immediate'
            }]
        )

        self.assertEqual(
            _ctx.instance.runtime_properties,
            RUNTIME_PROPERTIES_AFTER_CREATE
        )
    def test_configure_empty(self):
        _test_name = 'test_configure'
        _ctx = self.get_mock_ctx(
            _test_name,
            test_properties=NODE_PROPERTIES,
            test_runtime_properties=RUNTIME_PROPERTIES_AFTER_CREATE,
            type_hierarchy=PARAMETER_GROUP_TH
        )
        current_ctx.set(_ctx)

        parameter_group.configure(
            ctx=_ctx, resource_config=None, iface=None
        )

        self.assertEqual(
            _ctx.instance.runtime_properties,
            RUNTIME_PROPERTIES_AFTER_CREATE
        )