def test_generate(self):
        """CLI - Terraform Generate Rule Promotion"""
        result = rule_promotion.generate_rule_promotion(config=self.config)
        expected = {
            'module': {
                'rule_promotion_iam': {
                    'role_id':
                    '${module.rule_promotion_lambda.role_id}',
                    'function_alias_arn':
                    '${module.rule_promotion_lambda.function_alias_arn}',
                    'function_name':
                    '${module.rule_promotion_lambda.function_name}',
                    'rules_table_arn':
                    '${module.globals.rules_table_arn}',
                    'source':
                    'modules/tf_rule_promotion_iam',
                    'send_digest_schedule_expression':
                    'cron(30 13 * * ? *)',
                    'digest_sns_topic':
                    'staging_stats',
                    'athena_results_bucket_arn':
                    '${module.stream_alert_athena.results_bucket_arn}',
                    'athena_data_buckets': [
                        'unit-testing.streamalert.data',
                        'unit-testing.streamalerts'
                    ]
                },
                'rule_promotion_lambda': {
                    'alarm_actions': [
                        'arn:aws:sns:us-west-1:12345678910:stream_alert_monitoring'
                    ],
                    'description':
                    'Unit-Testing Streamalert Rule Promotion',
                    'environment_variables': {
                        'ENABLE_METRICS': '0',
                        'LOGGER_LEVEL': 'info'
                    },
                    'errors_alarm_enabled':
                    True,
                    'errors_alarm_evaluation_periods':
                    1,
                    'errors_alarm_period_secs':
                    2,
                    'errors_alarm_threshold':
                    3,
                    'filename':
                    'rule_promotion.zip',
                    'function_name':
                    'unit-testing_streamalert_rule_promotion',
                    'handler':
                    'stream_alert.rule_promotion.main.handler',
                    'log_retention_days':
                    10,
                    'memory_size_mb':
                    128,
                    'source':
                    'modules/tf_lambda',
                    'throttles_alarm_enabled':
                    True,
                    'throttles_alarm_evaluation_periods':
                    4,
                    'throttles_alarm_period_secs':
                    5,
                    'throttles_alarm_threshold':
                    6,
                    'timeout_sec':
                    120,
                    'schedule_expression':
                    'rate(10 minutes)'
                }
            }
        }

        assert_equal(expected, result)
 def test_generate_disabled(self):
     """CLI - Terraform Generate Rule Promotion, Staging Disabled"""
     result = rule_promotion.generate_rule_promotion(config=self.config)
     assert_equal(result, False)