
from irc3.testing import BotTestCase


class ExecutePluginTestCase(BotTestCase):

    config = {
        'includes': [
            'onebot.plugins.execute'
        ],
        'onebot.plugins.execute': {
            'commands': [
                'command1',
                'command2'
            ]
        }
    }

    def setUp(self):
        super(ExecutePluginTestCase, self).setUp()
        self.callFTU()
        self.bot.db = {}

    def test_command_allowed(self):
        self.bot.notify('connection_made')
        self.assertSent(['command1', 'command2'])


from irc3.testing import BotTestCase


class ExecutePluginTestCase(BotTestCase):

    config = {
        'includes': [
            'onebot.plugins.execute'
        ],
        'onebot.plugins.execute': {
            'commands': [
                'command1',
                'command2'
            ]
        }
    }

    def setUp(self):
        super(ExecutePluginTestCase, self).setUp()
        self.callFTU()
        self.bot.db = {}

    def test_connection_made(self):
        self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
        self.assertSent(['command1', 'command2'])

Fix test for connection made
Fix test for connection made

  
  from irc3.testing import BotTestCase
  
  
  class ExecutePluginTestCase(BotTestCase):
  
      config = {
          'includes': [
              'onebot.plugins.execute'
          ],
          'onebot.plugins.execute': {
              'commands': [
                  'command1',
                  'command2'
              ]
          }
      }
  
      def setUp(self):
          super(ExecutePluginTestCase, self).setUp()
          self.callFTU()
          self.bot.db = {}
  
-     def test_command_allowed(self):
-         self.bot.notify('connection_made')
+     def test_connection_made(self):
+         self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
          self.assertSent(['command1', 'command2'])
  
Fix test for connection made
## Code Before:

from irc3.testing import BotTestCase


class ExecutePluginTestCase(BotTestCase):

    config = {
        'includes': [
            'onebot.plugins.execute'
        ],
        'onebot.plugins.execute': {
            'commands': [
                'command1',
                'command2'
            ]
        }
    }

    def setUp(self):
        super(ExecutePluginTestCase, self).setUp()
        self.callFTU()
        self.bot.db = {}

    def test_command_allowed(self):
        self.bot.notify('connection_made')
        self.assertSent(['command1', 'command2'])

## Instruction:
Fix test for connection made
## Code After:

from irc3.testing import BotTestCase


class ExecutePluginTestCase(BotTestCase):

    config = {
        'includes': [
            'onebot.plugins.execute'
        ],
        'onebot.plugins.execute': {
            'commands': [
                'command1',
                'command2'
            ]
        }
    }

    def setUp(self):
        super(ExecutePluginTestCase, self).setUp()
        self.callFTU()
        self.bot.db = {}

    def test_connection_made(self):
        self.bot.dispatch(':irc.server 376 foo!nick@bar :something')
        self.assertSent(['command1', 'command2'])
