def test_config_cycle(testbot): testbot.push_message('!plugin config Webserver') m = testbot.pop_message() assert 'Default configuration for this plugin (you can copy and paste this directly as a command)' in m assert 'Current configuration' not in m testbot.assertCommand("!plugin config Webserver {'HOST': 'localhost', 'PORT': 3141, 'SSL': None}", 'Plugin configuration done.') assert 'Current configuration' in testbot.exec_command('!plugin config Webserver') assert 'localhost' in testbot.exec_command('!plugin config Webserver')
def test_config_cycle(testbot): testbot.push_message('!plugin config Webserver') m = testbot.pop_message() assert 'Default configuration for this plugin (you can copy and paste this directly as a command)' in m assert 'Current configuration' not in m testbot.assertCommand( "!plugin config Webserver {'HOST': 'localhost', 'PORT': 3141, 'SSL': None}", 'Plugin configuration done.') assert 'Current configuration' in testbot.exec_command( '!plugin config Webserver') assert 'localhost' in testbot.exec_command('!plugin config Webserver')
def test_plugin_cycle(testbot): plugins = [ 'errbotio/err-helloworld', ] for plugin in plugins: testbot.assertCommand( '!repos install {0}'.format(plugin), 'Installing {0}...'.format(plugin) ), assert 'A new plugin repository has been installed correctly from errbotio/err-helloworld' in \ testbot.pop_message(timeout=60) assert 'Plugins reloaded' in testbot.pop_message() assert 'this command says hello' in testbot.exec_command('!help hello') assert 'Hello World !' in testbot.exec_command('!hello') testbot.push_message('!plugin reload HelloWorld') assert 'Plugin HelloWorld reloaded.' == testbot.pop_message() testbot.push_message('!hello') # should still respond assert 'Hello World !' == testbot.pop_message() testbot.push_message('!plugin blacklist HelloWorld') assert 'Plugin HelloWorld is now blacklisted' == testbot.pop_message() testbot.push_message('!plugin deactivate HelloWorld') assert 'HelloWorld is already deactivated.' == testbot.pop_message() testbot.push_message('!hello') # should not respond assert 'Command "hello" not found' in testbot.pop_message() testbot.push_message('!plugin unblacklist HelloWorld') assert 'Plugin HelloWorld removed from blacklist' == testbot.pop_message() testbot.push_message('!plugin activate HelloWorld') assert 'HelloWorld is already activated.' == testbot.pop_message() testbot.push_message('!hello') # should respond back assert 'Hello World !' == testbot.pop_message() testbot.push_message('!repos uninstall errbotio/err-helloworld') assert 'Repo errbotio/err-helloworld removed.' == testbot.pop_message() testbot.push_message('!hello') # should not respond assert 'Command "hello" not found' in testbot.pop_message()
def test_plugin_cycle(testbot): plugins = [ 'errbotio/err-helloworld', ] for plugin in plugins: testbot.assertCommand('!repos install {0}'.format(plugin), 'Installing {0}...'.format(plugin)), assert 'A new plugin repository has been installed correctly from errbotio/err-helloworld' in \ testbot.pop_message(timeout=60) assert 'Plugins reloaded' in testbot.pop_message() assert 'this command says hello' in testbot.exec_command('!help hello') assert 'Hello World !' in testbot.exec_command('!hello') testbot.push_message('!plugin reload HelloWorld') assert 'Plugin HelloWorld reloaded.' == testbot.pop_message() testbot.push_message('!hello') # should still respond assert 'Hello World !' == testbot.pop_message() testbot.push_message('!plugin blacklist HelloWorld') assert 'Plugin HelloWorld is now blacklisted' == testbot.pop_message() testbot.push_message('!plugin deactivate HelloWorld') assert 'HelloWorld is already deactivated.' == testbot.pop_message() testbot.push_message('!hello') # should not respond assert 'Command "hello" not found' in testbot.pop_message() testbot.push_message('!plugin unblacklist HelloWorld') assert 'Plugin HelloWorld removed from blacklist' == testbot.pop_message( ) testbot.push_message('!plugin activate HelloWorld') assert 'HelloWorld is already activated.' == testbot.pop_message() testbot.push_message('!hello') # should respond back assert 'Hello World !' == testbot.pop_message() testbot.push_message('!repos uninstall errbotio/err-helloworld') assert 'Repo errbotio/err-helloworld removed.' == testbot.pop_message() testbot.push_message('!hello') # should not respond assert 'Command "hello" not found' in testbot.pop_message()
def test_webserver_webhook_test(testbot): testbot.push_message( "!plugin config Webserver {'HOST': 'localhost', 'PORT': 3141, 'SSL': None}" ) assert 'Plugin configuration done.' in testbot.pop_message() testbot.assertCommand("!webhook test /echo toto", 'Status code : 200')
def test_webserver_webhook_test(testbot): testbot.push_message("!plugin config Webserver {'HOST': 'localhost', 'PORT': 3141, 'SSL': None}") assert 'Plugin configuration done.' in testbot.pop_message() testbot.assertCommand("!webhook test /echo toto", 'Status code : 200')
def test_i18n_return(testbot): testbot.assertCommand('!i18n 1', 'язы́к')
def test_i18n_simple_name(testbot): testbot.assertCommand('!ру́сский', 'OK')
def test_i18n_prefix(testbot): testbot.assertCommand('!prefix_ру́сский', 'OK') testbot.assertCommand('!prefix ру́сский', 'OK')
def test_i18n_suffix(testbot): testbot.assertCommand('!ру́сский_suffix', 'OK') testbot.assertCommand('!ру́сский suffix', 'OK')
def test_assertCommand(testbot): testbot.assertCommand('!about', 'Err version')
def test_command(self, testbot): testbot.assertCommand('!teststorage', 'OK')
def test_extra_plugin_dir(testbot): testbot.assertCommand('!foo', 'bar')