# Path: bugwarrior/services/activecollab2.py
# class ActiveCollab2Service(IssueService):
#     ISSUE_CLASS = ActiveCollab2Issue
#     CONFIG_SCHEMA = ActiveCollab2Config
# 
#     def __init__(self, *args, **kw):
#         super().__init__(*args, **kw)
# 
#         self.client = ActiveCollab2Client(self.config.url,
#                                           self.config.key,
#                                           self.config.user_id,
#                                           self.config.projects,
#                                           self.target)
# 
#     def get_owner(self, issue):
#         # TODO
#         raise NotImplementedError(
#             "This service has not implemented support for 'only_if_assigned'.")
# 
#     def issues(self):
#         # Loop through each project
#         start = time.time()
#         issue_generators = []
#         projects = self.config.projects
#         for project in projects:
#             for project_id, project_name in project.items():
#                 log.debug(
#                     " Getting tasks for #" + project_id +
#                     " " + project_name + '"')
#                 issue_generators.append(
#                     self.client.get_issue_generator(
#                         self.config.user_id, project_id, project_name
#                     )
#                 )
# 
#         log.debug(" Elapsed Time: %s" % (time.time() - start))
# 
#         for record in itertools.chain(*issue_generators):
#             yield self.get_issue_for_record(record)
# 
# 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 re
import datetime
import pytz
import responses
from bugwarrior.services.activecollab2 import ActiveCollab2Service
from .base import ServiceTest, AbstractServiceTest
        'activecollab2.user_id': 0,
        'activecollab2.projects': '1:one, 2:two'
    }

    arbitrary_due_on = (
        datetime.datetime.now() - datetime.timedelta(hours=1)
    ).replace(tzinfo=pytz.UTC)
    arbitrary_created_on = (
        datetime.datetime.now() - datetime.timedelta(hours=2)
    ).replace(tzinfo=pytz.UTC)
    arbitrary_issue = {
        'project': 'something',
        'priority': 2,
        'due_on': arbitrary_due_on.isoformat(),
        'permalink': 'http://wherever/',
        'ticket_id': 10,
        'project_id': 20,
        'type': 'Ticket',
        'created_on': arbitrary_created_on.isoformat(),
        'created_by_id': '10',
        'body': 'Ticket Body',
        'name': 'Anonymous',
        'assignees': [
            {'user_id': SERVICE_CONFIG['activecollab2.user_id'],
             'is_owner': True}
        ],
        'description': 'Further detail.',
    }

    def setUp(self):

# Path: bugwarrior/services/activecollab2.py
# class ActiveCollab2Service(IssueService):
#     ISSUE_CLASS = ActiveCollab2Issue
#     CONFIG_SCHEMA = ActiveCollab2Config
# 
#     def __init__(self, *args, **kw):
#         super().__init__(*args, **kw)
# 
#         self.client = ActiveCollab2Client(self.config.url,
#                                           self.config.key,
#                                           self.config.user_id,
#                                           self.config.projects,
#                                           self.target)
# 
#     def get_owner(self, issue):
#         # TODO
#         raise NotImplementedError(
#             "This service has not implemented support for 'only_if_assigned'.")
# 
#     def issues(self):
#         # Loop through each project
#         start = time.time()
#         issue_generators = []
#         projects = self.config.projects
#         for project in projects:
#             for project_id, project_name in project.items():
#                 log.debug(
#                     " Getting tasks for #" + project_id +
#                     " " + project_name + '"')
#                 issue_generators.append(
#                     self.client.get_issue_generator(
#                         self.config.user_id, project_id, project_name
#                     )
#                 )
# 
#         log.debug(" Elapsed Time: %s" % (time.time() - start))
# 
#         for record in itertools.chain(*issue_generators):
#             yield self.get_issue_for_record(record)
# 
# 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_activecollab2.py
import re
import datetime
import pytz
import responses
from bugwarrior.services.activecollab2 import ActiveCollab2Service
from .base import ServiceTest, AbstractServiceTest

        'activecollab2.user_id': 0,
        'activecollab2.projects': '1:one, 2:two'
    }

    arbitrary_due_on = (
        datetime.datetime.now() - datetime.timedelta(hours=1)
    ).replace(tzinfo=pytz.UTC)
    arbitrary_created_on = (
        datetime.datetime.now() - datetime.timedelta(hours=2)
    ).replace(tzinfo=pytz.UTC)
    arbitrary_issue = {
        'project': 'something',
        'priority': 2,
        'due_on': arbitrary_due_on.isoformat(),
        'permalink': 'http://wherever/',
        'ticket_id': 10,
        'project_id': 20,
        'type': 'Ticket',
        'created_on': arbitrary_created_on.isoformat(),
        'created_by_id': '10',
        'body': 'Ticket Body',
        'name': 'Anonymous',
        'assignees': [
            {'user_id': SERVICE_CONFIG['activecollab2.user_id'],
             'is_owner': True}
        ],
        'description': 'Further detail.',
    }

    def setUp(self):

        super().setUp()