Beispiel #1
0
def make_script_feature_controller(script_name):
    """Create a `FeatureController` for the named script.

    You can then install this feature controller using
    `install_feature_controller`.
    """
    # Avoid circular import.
    from lp.services.features.flags import FeatureController
    from lp.services.features.rulesource import StormFeatureRuleSource
    from lp.services.features.scopes import ScopesForScript

    return FeatureController(
        ScopesForScript(script_name).lookup, StormFeatureRuleSource())
 def test_ScopesForScript_lookup_does_not_find_other_script(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertFalse(scopes.lookup("script:other"))
 def test_ScopesForScript_lookup_finds_script(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertTrue(scopes.lookup("script:" + script_name))
 def test_ScopesForScript_includes_default_scope(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertTrue(scopes.lookup("default"))
Beispiel #5
0
 def test_ScopesForScript_lookup_does_not_find_other_script(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertFalse(scopes.lookup("script:other"))
Beispiel #6
0
 def test_ScopesForScript_lookup_finds_script(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertTrue(scopes.lookup("script:" + script_name))
Beispiel #7
0
 def test_ScopesForScript_includes_default_scope(self):
     script_name = self.factory.getUniqueString()
     scopes = ScopesForScript(script_name)
     self.assertTrue(scopes.lookup("default"))