You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
shadowdice/tests/test_randomizer_metadata.py

23 lines
1007 B

import configparser
from json import loads
from JJMumbleBot.lib.utils.dir_utils import get_extension_plugin_dir
from JJMumbleBot.lib.resources.strings import C_PLUGIN_INFO, P_PLUGIN_VERS, P_PLUGIN_CMDS, C_PLUGIN_SET
from JJMumbleBot.plugins.extensions.randomizer.randomizer import Plugin
class TestRandomizer:
def setup_method(self):
# Initialize configs.
self.cfg = configparser.ConfigParser()
self.cfg.read(f"{get_extension_plugin_dir()}/randomizer/metadata.ini")
def test_plugin_version(self):
assert self.cfg[C_PLUGIN_INFO][P_PLUGIN_VERS] == "1.0.0"
def test_commands_list_size(self):
commands_list = list(loads(self.cfg[C_PLUGIN_INFO][P_PLUGIN_CMDS]))
assert len(commands_list) == 3
def test_match_commands_to_methods(self):
method_list = [item for item in dir(Plugin) if callable(getattr(Plugin, item)) and item.startswith("cmd_")]
assert len(method_list) == len(list(loads(self.cfg[C_PLUGIN_INFO][P_PLUGIN_CMDS])))