# Path: tests/base.py
# class ServiceTest(ConfigTest):
#     GENERAL_CONFIG = {
#         'interactive': False,
#         'annotation_length': 100,
#         'description_length': 100,
#     }
#     SERVICE_CONFIG = {
#     }
# 
#     @classmethod
#     def setUpClass(cls):
#         cls.maxDiff = None
# 
#     def get_mock_service(
#         self, service_class, section='unspecified',
#         config_overrides=None, general_overrides=None
#     ):
#         options = {
#             'general': {**self.GENERAL_CONFIG, 'targets': section},
#             section: self.SERVICE_CONFIG.copy(),
#         }
#         if config_overrides:
#             options[section].update(config_overrides)
#         if general_overrides:
#             options['general'].update(general_overrides)
# 
#         service_config = service_class.CONFIG_SCHEMA(**options[section])
#         main_config = schema.MainSectionConfig(**options['general'])
#         main_config.data = data.BugwarriorData(self.lists_path)
# 
#         return service_class(service_config, main_config, section)
# 
#     @staticmethod
#     def add_response(url, **kwargs):
#         responses.add(responses.GET, url, match_querystring=True, **kwargs)
# 
# Path: tests/test_service.py
# class DumbIssue(services.Issue):
#     """
#     Implement the required methods but they shouldn't be called.
#     """
#     def get_default_description(self):
#         raise NotImplementedError
# 
#     def to_taskwarrior(self):
#         raise NotImplementedError


from .base import ServiceTest
from .test_service import DumbIssue
class TestTemplates(ServiceTest):
    def setUp(self):
        super().setUp()
        self.arbitrary_default_description = 'Construct Library on Terminus'
        self.arbitrary_issue = {
            'project': 'end_of_empire',
            'priority': 'H',
        }

    def get_issue(
        self, templates=None, issue=None, description=None, add_tags=None
    ):
        templates = {} if templates is None else templates
        origin = {
            'annotation_length': 100,  # Arbitrary
            'default_priority': 'H',  # Arbitrary
            'description_length': 100,  # Arbitrary
            'templates': templates,
            'shorten': False,  # Arbitrary
            'add_tags': add_tags if add_tags else [],
        }

        issue = DumbIssue({}, origin)
        issue.to_taskwarrior = lambda: (
            self.arbitrary_issue if description is None else description
        )
        issue.get_default_description = lambda: (
            self.arbitrary_default_description
            if description is None else description
        )

# Path: tests/base.py
# class ServiceTest(ConfigTest):
#     GENERAL_CONFIG = {
#         'interactive': False,
#         'annotation_length': 100,
#         'description_length': 100,
#     }
#     SERVICE_CONFIG = {
#     }
# 
#     @classmethod
#     def setUpClass(cls):
#         cls.maxDiff = None
# 
#     def get_mock_service(
#         self, service_class, section='unspecified',
#         config_overrides=None, general_overrides=None
#     ):
#         options = {
#             'general': {**self.GENERAL_CONFIG, 'targets': section},
#             section: self.SERVICE_CONFIG.copy(),
#         }
#         if config_overrides:
#             options[section].update(config_overrides)
#         if general_overrides:
#             options['general'].update(general_overrides)
# 
#         service_config = service_class.CONFIG_SCHEMA(**options[section])
#         main_config = schema.MainSectionConfig(**options['general'])
#         main_config.data = data.BugwarriorData(self.lists_path)
# 
#         return service_class(service_config, main_config, section)
# 
#     @staticmethod
#     def add_response(url, **kwargs):
#         responses.add(responses.GET, url, match_querystring=True, **kwargs)
# 
# Path: tests/test_service.py
# class DumbIssue(services.Issue):
#     """
#     Implement the required methods but they shouldn't be called.
#     """
#     def get_default_description(self):
#         raise NotImplementedError
# 
#     def to_taskwarrior(self):
#         raise NotImplementedError


# Path: tests/test_templates.py
from .base import ServiceTest
from .test_service import DumbIssue

class TestTemplates(ServiceTest):
    def setUp(self):
        super().setUp()
        self.arbitrary_default_description = 'Construct Library on Terminus'
        self.arbitrary_issue = {
            'project': 'end_of_empire',
            'priority': 'H',
        }

    def get_issue(
        self, templates=None, issue=None, description=None, add_tags=None
    ):
        templates = {} if templates is None else templates
        origin = {
            'annotation_length': 100,  # Arbitrary
            'default_priority': 'H',  # Arbitrary
            'description_length': 100,  # Arbitrary
            'templates': templates,
            'shorten': False,  # Arbitrary
            'add_tags': add_tags if add_tags else [],
        }

        issue = DumbIssue({}, origin)
        issue.to_taskwarrior = lambda: (
            self.arbitrary_issue if description is None else description
        )
        issue.get_default_description = lambda: (
            self.arbitrary_default_description
            if description is None else description
        )

        return issue