def test_update_policy_with_minimal_parameters(self): expected_update_policy = { 'CodeDeployLambdaAliasUpdate': { 'ApplicationName': {'Ref': CODEDEPLOY_APPLICATION_LOGICAL_ID}, 'DeploymentGroupName': {'Ref': self.function_logical_id + 'DeploymentGroup'}, } } deployment_preference_collection = DeploymentPreferenceCollection() deployment_preference_collection.add(self.function_logical_id, {'Type': 'CANARY'}) update_policy = deployment_preference_collection.update_policy(self.function_logical_id) self.assertEqual(expected_update_policy, update_policy.to_dict())
def test_update_policy_with_minimal_parameters(self): expected_update_policy = { "CodeDeployLambdaAliasUpdate": { "ApplicationName": {"Ref": CODEDEPLOY_APPLICATION_LOGICAL_ID}, "DeploymentGroupName": {"Ref": self.function_logical_id + "DeploymentGroup"}, } } deployment_preference_collection = DeploymentPreferenceCollection() deployment_preference_collection.add(self.function_logical_id, {"Type": "CANARY"}) update_policy = deployment_preference_collection.update_policy(self.function_logical_id) self.assertEqual(expected_update_policy, update_policy.to_dict())
def test_update_policy_with_all_parameters(self): expected_update_polcy = { 'CodeDeployLambdaAliasUpdate': { 'ApplicationName': {'Ref': CODEDEPLOY_APPLICATION_LOGICAL_ID}, 'DeploymentGroupName': {'Ref': self.function_logical_id + 'DeploymentGroup'}, 'BeforeAllowTrafficHook': self.pre_traffic_hook_global, 'AfterAllowTrafficHook': self.post_traffic_host_global, } } deployment_preference_collection = DeploymentPreferenceCollection() deployment_preference_collection.add(self.function_logical_id, self.global_deployment_preference_yaml_dict()) update_policy = deployment_preference_collection.update_policy(self.function_logical_id) self.assertEqual(expected_update_polcy, update_policy.to_dict())