# 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)


from tests.isolated_testcase import IsolatedTestCase


class SearchDocsTest(IsolatedTestCase):

    def test_search_cmd(self):
        self.assertCommand(
            '!search api search string',
            'https://api.coala.io/en/latest/search.html?q=search+string')
        self.assertCommand(
            '!search user search string',
            'https://docs.coala.io/en/latest/search.html?q=search+string')

# 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/searchdocs_test.py
from tests.isolated_testcase import IsolatedTestCase



class SearchDocsTest(IsolatedTestCase):

    def test_search_cmd(self):
        self.assertCommand(
            '!search api search string',
            'https://api.coala.io/en/latest/search.html?q=search+string')
        self.assertCommand(
            '!search user search string',
            'https://docs.coala.io/en/latest/search.html?q=search+string')

        self.assertCommand('!search not matching',