# Path: bugwarrior/services/redmine.py
# class RedMineService(IssueService):
#     ISSUE_CLASS = RedMineIssue
#     CONFIG_SCHEMA = RedMineConfig
# 
#     def __init__(self, *args, **kw):
#         super().__init__(*args, **kw)
# 
#         self.key = self.get_password('key')
# 
#         password = (self.get_password('password', self.config.login)
#                     if self.config.login else None)
#         auth = ((self.config.login, password)
#                 if (self.config.login and password) else None)
#         self.client = RedMineClient(self.config.url,
#                                     self.key,
#                                     auth,
#                                     self.config.issue_limit,
#                                     self.config.verify_ssl)
# 
#     def get_service_metadata(self):
#         return {
#             'project_name': self.config.project_name,
#             'url': self.config.url,
#         }
# 
#     @staticmethod
#     def get_keyring_service(config):
#         return f"redmine://{config.login}@{config.url}/"
# 
#     def get_owner(self, issue):
#         # Issue filtering is implemented as part of the api query.
#         pass
# 
#     def issues(self):
#         issues = self.client.find_issues(
#             self.config.issue_limit, self.config.only_if_assigned)
#         log.debug(" Found %i total.", len(issues))
#         for issue in issues:
#             yield self.get_issue_for_record(issue)
# 
# 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


import datetime
import dateutil
import responses
from unittest import mock
from bugwarrior.services.redmine import RedMineService
from .base import ServiceTest, AbstractServiceTest





class TestRedmineIssue(AbstractServiceTest, ServiceTest):
    maxDiff = None
    SERVICE_CONFIG = {
        'service': 'redmine',
        'redmine.url': 'https://something',
        'redmine.key': 'something_else',

# Path: bugwarrior/services/redmine.py
# class RedMineService(IssueService):
#     ISSUE_CLASS = RedMineIssue
#     CONFIG_SCHEMA = RedMineConfig
# 
#     def __init__(self, *args, **kw):
#         super().__init__(*args, **kw)
# 
#         self.key = self.get_password('key')
# 
#         password = (self.get_password('password', self.config.login)
#                     if self.config.login else None)
#         auth = ((self.config.login, password)
#                 if (self.config.login and password) else None)
#         self.client = RedMineClient(self.config.url,
#                                     self.key,
#                                     auth,
#                                     self.config.issue_limit,
#                                     self.config.verify_ssl)
# 
#     def get_service_metadata(self):
#         return {
#             'project_name': self.config.project_name,
#             'url': self.config.url,
#         }
# 
#     @staticmethod
#     def get_keyring_service(config):
#         return f"redmine://{config.login}@{config.url}/"
# 
#     def get_owner(self, issue):
#         # Issue filtering is implemented as part of the api query.
#         pass
# 
#     def issues(self):
#         issues = self.client.find_issues(
#             self.config.issue_limit, self.config.only_if_assigned)
#         log.debug(" Found %i total.", len(issues))
#         for issue in issues:
#             yield self.get_issue_for_record(issue)
# 
# 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_redmine.py
import datetime
import dateutil
import responses
from unittest import mock
from bugwarrior.services.redmine import RedMineService
from .base import ServiceTest, AbstractServiceTest






class TestRedmineIssue(AbstractServiceTest, ServiceTest):
    maxDiff = None
    SERVICE_CONFIG = {
        'service': 'redmine',
        'redmine.url': 'https://something',
        'redmine.key': 'something_else',

        'redmine.issue_limit': '100',