itests: allow pconfig registration with plugins

This commit is contained in:
mathieui 2021-02-05 19:11:19 +01:00
parent d6ab3124ce
commit 6c3f26161e

View file

@ -16,7 +16,9 @@ except ImportError:
# not usable. # not usable.
from unittest import TestCase as IsolatedAsyncioTestCase from unittest import TestCase as IsolatedAsyncioTestCase
from typing import ( from typing import (
Dict,
List, List,
Optional,
) )
from slixmpp import JID from slixmpp import JID
@ -39,10 +41,13 @@ class SlixIntegration(IsolatedAsyncioTestCase):
"""get a str from an env var""" """get a str from an env var"""
return os.getenv(name) return os.getenv(name)
def register_plugins(self, plugins: List[str]): def register_plugins(self, plugins: List[str], configs: Optional[List[Dict]] = None):
"""Register plugins on all known clients""" """Register plugins on all known clients"""
for plugin in plugins: for index, plugin in enumerate(plugins):
for client in self.clients: for client in self.clients:
if configs is not None:
client.register_plugin(plugin, pconfig=configs[index])
else:
client.register_plugin(plugin) client.register_plugin(plugin)
def add_client(self, jid: JID, password: str): def add_client(self, jid: JID, password: str):