How to use the bugwarrior.services.gitlab.GitlabService 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_gitlab.py View on Github external
def setUp(self):
        super(TestGitlabIssue, self).setUp()
        self.service = self.get_mock_service(GitlabService)
        self.arbitrary_created = (
            datetime.datetime.utcnow() - datetime.timedelta(hours=1)
        ).replace(tzinfo=pytz.UTC, microsecond=0)
        self.arbitrary_updated = datetime.datetime.utcnow().replace(
            tzinfo=pytz.UTC, microsecond=0)
        self.arbitrary_duedate = (
            datetime.datetime.combine(datetime.date.today(),
                                      datetime.datetime.min.time())
        ).replace(tzinfo=pytz.UTC)
        self.arbitrary_issue = {
            "id": 42,
            "iid": 3,
            "project_id": 8,
            "title": "Add user settings",
            "description": "",
            "labels": [
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_add_default_namespace_to_excluded_repos(self):
        self.config.set('myservice', 'gitlab.exclude_repos', 'baz, banana/tree')
        service = GitlabService(self.config, 'general', 'myservice')
        self.assertEqual(service.exclude_repos, ['foobar/baz', 'banana/tree'])
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_filter_repos_exclude(self):
        self.config.set('myservice', 'gitlab.exclude_repos', 'foobar/baz')
        service = GitlabService(self.config, 'general', 'myservice')
        repo = {'path_with_namespace': 'foobar/baz', 'id': 1234}
        self.assertFalse(service.filter_repos(repo))
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_get_keyring_service_custom_host(self):
        self.config.set('myservice', 'gitlab.host', 'gitlab.example.com')
        self.assertEqual(
            GitlabService.get_keyring_service(self.service_config),
            'gitlab://foobar@gitlab.example.com')
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_filter_repos_exclude_id(self):
        self.config.set('myservice', 'gitlab.exclude_repos', 'id:1234')
        service = GitlabService(self.config, 'general', 'myservice')
        repo = {'path_with_namespace': 'foobar/baz', 'id': 1234}
        self.assertFalse(service.filter_repos(repo))
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_filter_repos_include_id(self):
        self.config.set('myservice', 'gitlab.include_repos', 'id:1234')
        service = GitlabService(self.config, 'general', 'myservice')
        repo = {'path_with_namespace': 'foobar/baz', 'id': 1234}
        self.assertTrue(service.filter_repos(repo))
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_gitlab.py View on Github external
def test_filter_repos_include(self):
        self.config.set('myservice', 'gitlab.include_repos', 'foobar/baz')
        service = GitlabService(self.config, 'general', 'myservice')
        repo = {'path_with_namespace': 'foobar/baz', 'id': 1234}
        self.assertTrue(service.filter_repos(repo))
github ralphbean / bugwarrior / tests / test_gitlab.py View on Github external
def test_add_default_namespace_to_included_repos(self):
        self.config.set('myservice', 'gitlab.include_repos', 'baz, banana/tree')
        service = GitlabService(self.config, 'general', 'myservice')
        self.assertEqual(service.include_repos, ['foobar/baz', 'banana/tree'])
github ralphbean / bugwarrior / bugwarrior / services / gitlab.py View on Github external
def __init__(self, *args, **kw):
        super(GitlabService, self).__init__(*args, **kw)

        host = self.config.get(
            'host', default='gitlab.com', to_type=six.text_type)
        self.login = self.config.get('login')
        token = self.get_password('token', self.login)
        self.auth = (host, token)

        if self.config.get('use_https', default=True, to_type=asbool):
            self.scheme = 'https'
        else:
            self.scheme = 'http'

        self.verify_ssl = self.config.get(
            'verify_ssl', default=True, to_type=asbool
        )