How to use the bugwarrior.config.ServiceConfig function in bugwarrior

To help you get started, we’ve selected a few bugwarrior examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ralphbean / bugwarrior / tests / test_config.py View on Github external
def setUp(self):
        self.target = 'someservice'

        self.config = config.BugwarriorConfigParser()
        self.config.add_section(self.target)
        self.config.set(self.target, 'someprefix.someint', '4')
        self.config.set(self.target, 'someprefix.somenone', '')
        self.config.set(self.target, 'someprefix.somechar', 'somestring')
        self.config.set(self.target, 'someprefix.somebool', 'true')

        self.service_config = config.ServiceConfig(
            'someprefix', self.config, self.target)
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def setUp(self):
        super(TestGitlabService, self).setUp()
        self.config = configparser.RawConfigParser()
        self.config.add_section('general')
        self.config.add_section('myservice')
        self.config.set('myservice', 'gitlab.login', 'foobar')
        self.config.set('myservice', 'gitlab.token', 'XXXXXX')
        self.service_config = ServiceConfig(
            GitlabService.CONFIG_PREFIX, self.config, 'myservice')
github ralphbean / bugwarrior / tests / test_github.py View on Github external
def setUp(self):
        self.config = RawConfigParser()
        self.config.interactive = False
        self.config.add_section('general')
        self.config.add_section('mygithub')
        self.config.set('mygithub', 'service', 'github')
        self.config.set('mygithub', 'github.login', 'tintin')
        self.config.set('mygithub', 'github.username', 'milou')
        self.config.set('mygithub', 'github.password', 't0ps3cr3t')
        self.service_config = ServiceConfig(
            GithubService.CONFIG_PREFIX, self.config, 'mygithub')
github ralphbean / bugwarrior / tests / test_trello.py View on Github external
def setUp(self):
        super(TestTrelloService, self).setUp()
        self.config = configparser.RawConfigParser()
        self.config.add_section('general')
        self.config.add_section('mytrello')
        self.config.set('mytrello', 'trello.api_key', 'XXXX')
        self.config.set('mytrello', 'trello.token', 'YYYY')
        self.service_config = ServiceConfig(
            TrelloService.CONFIG_PREFIX, self.config, 'mytrello')
        responses.add(responses.GET,
                      'https://api.trello.com/1/lists/L15T/cards/open',
                      json=[self.CARD1, self.CARD2, self.CARD3])
        responses.add(responses.GET,
                      'https://api.trello.com/1/boards/B04RD/lists/open',
                      json=[self.LIST1, self.LIST2])
        responses.add(responses.GET,
                      'https://api.trello.com/1/boards/F00',
                      json={'id': 'F00', 'name': 'Foo Board'})
        responses.add(responses.GET,
                      'https://api.trello.com/1/boards/B4R',
                      json={'id': 'B4R', 'name': 'Bar Board'})
        responses.add(responses.GET,
                      'https://api.trello.com/1/members/me/boards',
                      json=[self.BOARD])
github ralphbean / bugwarrior / tests / test_bugzilla.py View on Github external
def setUp(self):
        super(TestBugzillaServiceConfig, self).setUp()
        self.config = configparser.RawConfigParser()
        self.config.add_section('general')
        self.config.add_section('mybz')
        self.service_config = ServiceConfig(
            BugzillaService.CONFIG_PREFIX, self.config, 'mybz')
github ralphbean / bugwarrior / bugwarrior / config.py View on Github external
for target in targets:
        if target not in config.sections():
            die("No [%s] section found." % target)

    # Validate each target one by one.
    for target in targets:
        service = config.get(target, 'service')
        if not service:
            die("No 'service' in [%s]" % target)

        if not get_service(service):
            die("'%s' in [%s] is not a valid service." % (service, target))

        # Call the service-specific validator
        service = get_service(service)
        service_config = ServiceConfig(service.CONFIG_PREFIX, config, target)
        service.validate_config(service_config, target)
github ralphbean / bugwarrior / bugwarrior / services / __init__.py View on Github external
def __init__(self, main_config, main_section, target):
        self.config = ServiceConfig(self.CONFIG_PREFIX, main_config, target)
        self.main_section = main_section
        self.main_config = main_config
        self.target = target

        self.desc_len = self._get_config_or_default('description_length', 35, asint);
        self.anno_len = self._get_config_or_default('annotation_length', 45, asint);
        self.inline_links = self._get_config_or_default('inline_links', True, asbool);
        self.annotation_links = self._get_config_or_default('annotation_links', not self.inline_links, asbool)
        self.annotation_comments = self._get_config_or_default('annotation_comments', True, asbool)
        self.annotation_newlines = self._get_config_or_default('annotation_newlines', False, asbool)
        self.shorten = self._get_config_or_default('shorten', False, asbool)

        self.default_priority = self.config.get('default_priority', 'M')

        self.add_tags = []
        for raw_option in aslist(self.config.get('add_tags', '')):
github ralphbean / bugwarrior / bugwarrior / command.py View on Github external
def targets():
    config = load_config('general')
    for section in config.sections():
        if section in ['general', 'notifications'] or \
           section.startswith('flavor.'):
            continue
        service_name = config.get(section, 'service')
        service_class = get_service(service_name)
        for option in config.options(section):
            value = config.get(section, option)
            if not value:
                continue
            if '@oracle:use_keyring' in value:
                service_config = ServiceConfig(
                    service_class.CONFIG_PREFIX, config, section)
                yield service_class.get_keyring_service(service_config)