# Path: bugwarrior/services/bts.py
# UDD_BUGS_SEARCH = "https://udd.debian.org/bugs/"
#     SUBJECT = 'btssubject'
#     URL = 'btsurl'
#     NUMBER = 'btsnumber'
#     PACKAGE = 'btspackage'
#     SOURCE = 'btssource'
#     FORWARDED = 'btsforwarded'
#     STATUS = 'btsstatus'
#     UDAS = {
#         SUBJECT: {
#             'type': 'string',
#             'label': 'Debian BTS Subject',
#         },
#         URL: {
#             'type': 'string',
#             'label': 'Debian BTS URL',
#         },
#         NUMBER: {
#             'type': 'numeric',
#             'label': 'Debian BTS Number',
#         },
#         PACKAGE: {
#             'type': 'string',
#             'label': 'Debian BTS Package',
#         },
#         SOURCE: {
#             'type': 'string',
#             'label': 'Debian BTS Source Package',
#         },
#         FORWARDED: {
#             'type': 'string',
#             'label': 'Debian BTS Forwarded URL',
#         },
#         STATUS: {
#             'type': 'string',
#             'label': 'Debian BTS Status',
#         }
#     }
#     UNIQUE_KEY = (URL, )
#     PRIORITY_MAP = {
#         'wishlist': 'L',
#         'minor': 'L',
#         'normal': 'M',
#         'important': 'M',
#         'serious': 'H',
#         'grave': 'H',
#         'critical': 'H',
#     }
#     ISSUE_CLASS = BTSIssue
#     CONFIG_SCHEMA = BTSConfig
# class BTSConfig(config.ServiceConfig, prefix='bts'):
# class BTSIssue(Issue):
# class BTSService(IssueService, ServiceClient):
#     def require_email_or_packages(cls, values):
#     def udd_needs_email(cls, values):
#     def to_taskwarrior(self):
#     def get_default_description(self):
#     def get_priority(self):
#     def get_owner(self, issue):
#     def _record_for_bug(self, bug):
#     def _get_udd_bugs(self):
#     def annotations(self, issue, issue_obj):
#     def issues(self):
# 
# 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)
# 
# class AbstractServiceTest(abc.ABC):
#     """ Ensures that certain test methods are implemented for each service. """
#     @abc.abstractmethod
#     def test_to_taskwarrior(self):
#         """ Test Service.to_taskwarrior(). """
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def test_issues(self):
#         """
#         Test Service.issues().
# 
#         - When the API is accessed via requests, use the responses library to
#         mock requests.
#         - When the API is accessed via a third party library, substitute a fake
#         implementation class for it.
#         """
#         raise NotImplementedError


from unittest import mock
from bugwarrior.services import bts
from .base import ServiceTest, AbstractServiceTest

    SERVICE_CONFIG = {
        'service': 'bts',
        'bts.email': 'irl@debian.org',
        'bts.packages': 'bugwarrior',
    }

    def setUp(self):
        super().setUp()
        self.service = self.get_mock_service(bts.BTSService)

    def test_to_taskwarrior(self):
        issue = self.service.get_issue_for_record(
            self.service._record_for_bug(FakeBTSBug)
        )

        expected_output = {
            'priority': issue.PRIORITY_MAP[FakeBTSBug.severity],
            'annotations': [],

            issue.URL: "https://bugs.debian.org/" + str(FakeBTSBug.bug_num),
            issue.SUBJECT: FakeBTSBug.subject,
            issue.NUMBER: FakeBTSBug.bug_num,
            issue.PACKAGE: FakeBTSBug.package,
            issue.SOURCE: FakeBTSBug.source,
            issue.FORWARDED: FakeBTSBug.forwarded,
            issue.STATUS: FakeBTSBug.pending,
        }
        actual_output = issue.to_taskwarrior()


# Path: bugwarrior/services/bts.py
# UDD_BUGS_SEARCH = "https://udd.debian.org/bugs/"
#     SUBJECT = 'btssubject'
#     URL = 'btsurl'
#     NUMBER = 'btsnumber'
#     PACKAGE = 'btspackage'
#     SOURCE = 'btssource'
#     FORWARDED = 'btsforwarded'
#     STATUS = 'btsstatus'
#     UDAS = {
#         SUBJECT: {
#             'type': 'string',
#             'label': 'Debian BTS Subject',
#         },
#         URL: {
#             'type': 'string',
#             'label': 'Debian BTS URL',
#         },
#         NUMBER: {
#             'type': 'numeric',
#             'label': 'Debian BTS Number',
#         },
#         PACKAGE: {
#             'type': 'string',
#             'label': 'Debian BTS Package',
#         },
#         SOURCE: {
#             'type': 'string',
#             'label': 'Debian BTS Source Package',
#         },
#         FORWARDED: {
#             'type': 'string',
#             'label': 'Debian BTS Forwarded URL',
#         },
#         STATUS: {
#             'type': 'string',
#             'label': 'Debian BTS Status',
#         }
#     }
#     UNIQUE_KEY = (URL, )
#     PRIORITY_MAP = {
#         'wishlist': 'L',
#         'minor': 'L',
#         'normal': 'M',
#         'important': 'M',
#         'serious': 'H',
#         'grave': 'H',
#         'critical': 'H',
#     }
#     ISSUE_CLASS = BTSIssue
#     CONFIG_SCHEMA = BTSConfig
# class BTSConfig(config.ServiceConfig, prefix='bts'):
# class BTSIssue(Issue):
# class BTSService(IssueService, ServiceClient):
#     def require_email_or_packages(cls, values):
#     def udd_needs_email(cls, values):
#     def to_taskwarrior(self):
#     def get_default_description(self):
#     def get_priority(self):
#     def get_owner(self, issue):
#     def _record_for_bug(self, bug):
#     def _get_udd_bugs(self):
#     def annotations(self, issue, issue_obj):
#     def issues(self):
# 
# 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)
# 
# class AbstractServiceTest(abc.ABC):
#     """ Ensures that certain test methods are implemented for each service. """
#     @abc.abstractmethod
#     def test_to_taskwarrior(self):
#         """ Test Service.to_taskwarrior(). """
#         raise NotImplementedError
# 
#     @abc.abstractmethod
#     def test_issues(self):
#         """
#         Test Service.issues().
# 
#         - When the API is accessed via requests, use the responses library to
#         mock requests.
#         - When the API is accessed via a third party library, substitute a fake
#         implementation class for it.
#         """
#         raise NotImplementedError


# Path: tests/test_bts.py
from unittest import mock
from bugwarrior.services import bts
from .base import ServiceTest, AbstractServiceTest


    SERVICE_CONFIG = {
        'service': 'bts',
        'bts.email': 'irl@debian.org',
        'bts.packages': 'bugwarrior',
    }

    def setUp(self):
        super().setUp()
        self.service = self.get_mock_service(bts.BTSService)

    def test_to_taskwarrior(self):
        issue = self.service.get_issue_for_record(
            self.service._record_for_bug(FakeBTSBug)
        )

        expected_output = {
            'priority': issue.PRIORITY_MAP[FakeBTSBug.severity],
            'annotations': [],

            issue.URL: "https://bugs.debian.org/" + str(FakeBTSBug.bug_num),
            issue.SUBJECT: FakeBTSBug.subject,
            issue.NUMBER: FakeBTSBug.bug_num,
            issue.PACKAGE: FakeBTSBug.package,
            issue.SOURCE: FakeBTSBug.source,
            issue.FORWARDED: FakeBTSBug.forwarded,
            issue.STATUS: FakeBTSBug.pending,
        }
        actual_output = issue.to_taskwarrior()


        self.assertEqual(actual_output, expected_output)