示例#1
0
 def test_disable(self):
     registry.enable('#foo', 'foo', self.snowman)
     assert 'foo' in registry.enabled_plugins['#foo']
     assert self.snowman in registry.enabled_plugins['#foo']
     registry.disable('#foo', 'foo', self.snowman)
     assert 'foo' not in registry.enabled_plugins['#foo']
     assert self.snowman not in registry.enabled_plugins['#foo']
示例#2
0
 def test_disable(self):
     registry.enable('#foo', 'foo', self.snowman)
     assert 'foo' in registry.enabled_plugins['#foo']
     assert self.snowman in registry.enabled_plugins['#foo']
     registry.disable('#foo', 'foo', self.snowman)
     assert 'foo' not in registry.enabled_plugins['#foo']
     assert self.snowman not in registry.enabled_plugins['#foo']
示例#3
0
def disable_plugins(client, channel, *plugins):
    valid_plugins = _filter_valid(channel, *plugins)
    if not valid_plugins:
        return u"Sorry, but I don't know about these plugins: {0}".format(', '.join(plugins))

    registry.disable(channel, *valid_plugins)

    for p in valid_plugins:
        rec = db.auto_enabled_plugins.find_one({'plugin': p})
        if rec is None or channel not in rec['channels']:
            continue

        rec['channels'].remove(channel)
        db.auto_enabled_plugins.save(rec)

    return random.choice(ACKS)
示例#4
0
def disable_plugins(client, channel, *plugins):
    valid_plugins = _filter_valid(channel, *plugins)
    if not valid_plugins:
        return u"Sorry, but I don't know about these plugins: {0}".format(
            ', '.join(plugins))

    registry.disable(channel, *valid_plugins)

    for p in valid_plugins:
        rec = db.auto_enabled_plugins.find_one({'plugin': p})
        if rec is None or channel not in rec['channels']:
            continue

        rec['channels'].remove(channel)
        db.auto_enabled_plugins.save(rec)

    return random.choice(ACKS)