30 lines
804 B
Python
30 lines
804 B
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
|
|
SOURCE = Path(__file__).resolve().parents[1] / "src"
|
|
sys.path.insert(0, str(SOURCE))
|
|
|
|
from coin_ranking import AUTHOR, DESCRIPTION, HELP_ENTRIES, plugin
|
|
|
|
|
|
class PluginTests(unittest.TestCase):
|
|
def test_registers_declared_commands_and_author(self):
|
|
context = mock.Mock()
|
|
plugin(context)
|
|
registered = [
|
|
call.args[0]
|
|
for call in context.commands.register.call_args_list
|
|
]
|
|
self.assertEqual(AUTHOR, 'jwebot')
|
|
self.assertEqual(DESCRIPTION, '富榜')
|
|
self.assertEqual(HELP_ENTRIES, ('/大富翁榜',))
|
|
self.assertIn('/摩拉排行', registered)
|
|
self.assertEqual(len(registered), 6)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|