def setUp(self): """Set the feature flags that this fixture is responsible for.""" super(FeatureFixture, self).setUp() rule_source = StormFeatureRuleSource() self.addCleanup( rule_source.setAllRules, rule_source.getAllRulesAsTuples()) rule_source.setAllRules(self.makeNewRules()) original_controller = get_relevant_feature_controller() def scope_lookup(scope_name): request = get_current_browser_request() return ScopesFromRequest(request).lookup(scope_name) if self.override_scope_lookup: scope_lookup = self.override_scope_lookup install_feature_controller( FeatureController(scope_lookup, rule_source)) self.addCleanup(install_feature_controller, original_controller)
def setUp(self): """Set the feature flags that this fixture is responsible for.""" super(FeatureFixture, self).setUp() rule_source = StormFeatureRuleSource() self.addCleanup(rule_source.setAllRules, rule_source.getAllRulesAsTuples()) rule_source.setAllRules(self.makeNewRules()) original_controller = get_relevant_feature_controller() def scope_lookup(scope_name): request = get_current_browser_request() return ScopesFromRequest(request).lookup(scope_name) if self.override_scope_lookup: scope_lookup = self.override_scope_lookup install_feature_controller(FeatureController(scope_lookup, rule_source)) self.addCleanup(install_feature_controller, original_controller)
def test_getAllRulesAsTuples(self): source = StormFeatureRuleSource() source.setAllRules(test_rules_list) self.assertEquals(test_rules_list, list(source.getAllRulesAsTuples()))