# Path: tests/isolated_testcase.py
# class IsolatedTestCase(FullStackTest):
# 
#     file_path = Path(__file__).parent / '..' / 'plugins' / 'labhub.plug'
#     renamed_file_path = Path(__file__).parent / '..' / 'plugins' / 'hidden'
# 
#     @classmethod
#     def setUpClass(cls, extra_config=None):
#         os.rename(cls.file_path, cls.renamed_file_path)
# 
#     @classmethod
#     def tearDownClass(cls):
#         os.rename(cls.renamed_file_path, cls.file_path)
# 
#     def setUp(self, extra_config=None):
#         super().setUp(extra_plugin_dir='plugins',
#                       loglevel=logging.ERROR,
#                       extra_config=extra_config)


import queue
from tests.isolated_testcase import IsolatedTestCase



class TestSpam(IsolatedTestCase):

    def setUp(self):
        super().setUp()
        self.testbot = self

    def test_spam_callback(self):
        self.testbot.assertCommand('c'*1001, 'you\'re spamming')
        self.testbot.assertCommand('\n\n'*11, 'you\'re spamming')

    def test_spam_configuration(self):
        self.testbot.assertCommand('!plugin config SpammingAlert '
                                   '{\'MAX_LINES\': 10}',
                                   'configuration done')
        self.testbot.assertCommand('!plugin config SpammingAlert',
                                   '{\'MAX_LINES\': 10}')
        self.testbot.assertCommand('!plugin config SpammingAlert '
                                   '{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
                                   'configuration done')
        self.testbot.assertCommand('!plugin config SpammingAlert',
                                   '{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')



# Path: tests/isolated_testcase.py
# class IsolatedTestCase(FullStackTest):
# 
#     file_path = Path(__file__).parent / '..' / 'plugins' / 'labhub.plug'
#     renamed_file_path = Path(__file__).parent / '..' / 'plugins' / 'hidden'
# 
#     @classmethod
#     def setUpClass(cls, extra_config=None):
#         os.rename(cls.file_path, cls.renamed_file_path)
# 
#     @classmethod
#     def tearDownClass(cls):
#         os.rename(cls.renamed_file_path, cls.file_path)
# 
#     def setUp(self, extra_config=None):
#         super().setUp(extra_plugin_dir='plugins',
#                       loglevel=logging.ERROR,
#                       extra_config=extra_config)


# Path: tests/spam_test.py
import queue
from tests.isolated_testcase import IsolatedTestCase




class TestSpam(IsolatedTestCase):

    def setUp(self):
        super().setUp()
        self.testbot = self

    def test_spam_callback(self):
        self.testbot.assertCommand('c'*1001, 'you\'re spamming')
        self.testbot.assertCommand('\n\n'*11, 'you\'re spamming')

    def test_spam_configuration(self):
        self.testbot.assertCommand('!plugin config SpammingAlert '
                                   '{\'MAX_LINES\': 10}',
                                   'configuration done')
        self.testbot.assertCommand('!plugin config SpammingAlert',
                                   '{\'MAX_LINES\': 10}')
        self.testbot.assertCommand('!plugin config SpammingAlert '
                                   '{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}',
                                   'configuration done')
        self.testbot.assertCommand('!plugin config SpammingAlert',
                                   '{\'MAX_LINES\': 20, \'MAX_MSG_LEN\': 200}')



class TestSpamExtraConfig(IsolatedTestCase):