Add feature flags in config to enable tests conditionally

This would allow to skip tests if a required feature is not
enabled in the config.

Change-Id: Icb699497c1d348354b6a5880ea3e4ab2de6e059b
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index f75385f..a4c0edf 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -110,6 +110,22 @@
     return decorator
 
 
+def requires_feature(feature):
+    '''Decorator for tests requring specific feature.
+
+    The decorated test will be skipped when a specific feature is disabled.
+    '''
+    def decorator(test_method):
+        features_group = getattr(config.CONF, 'heat_features_enabled', None)
+        if not features_group:
+            return test_method
+        feature_enabled = config.CONF.heat_features_enabled.get(feature, False)
+        skipper = testtools.skipUnless(feature_enabled,
+                                       "%s - Feature not enabled." % feature)
+        return skipper(test_method)
+    return decorator
+
+
 class HeatIntegrationTest(testtools.testcase.WithAttributes,
                           testscenarios.WithScenarios,
                           testtools.TestCase):