Added commands order test

master
Jef Roosens 2020-08-26 14:12:58 +02:00
parent 0afb14203e
commit bc1a55f21f
2 changed files with 19 additions and 2 deletions

View File

@ -1,9 +1,17 @@
from frank import Module, command, default, daemon
from frank import Module, command, default, daemon, regex_command
class ModuleTester(Module):
PREFIX = 'tester'
@regex_command('pat')
async def regex1(pregix, cmd, author, channel, mid):
pass
@regex_command('pat2')
async def regex2(pregix, cmd, author, channel, mid):
pass
@command('test')
async def test(cmd, author, channel, mid):
pass

View File

@ -1,5 +1,5 @@
from .module_tester import ModuleTester
from frank import Default, Daemon, Command
from frank import Default, Daemon, Command, RegexCommand
from frank.module.exceptions import InvalidCommand
import pytest
@ -39,3 +39,12 @@ def test_match():
assert test_mod.match('tester')
assert not test_mod.match('testerrr')
def test_commands_order():
test_mod = ModuleTester(None)
types = [Command, RegexCommand, RegexCommand]
assert all((isinstance(cmd, obj_type)
for cmd, obj_type in zip(test_mod.commands, types)))