Exemple #1
0
 def test_get_query_gitlab():
     token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     _fetch(GITLAB_BASE_URL,
            'get',
            token,
            '/projects',
            query_params={'owned': True})
    def setUp(self):
        self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))

        self.org = GitLabOrganization(self.token, 'gitmate-test-org')
        self.suborg = GitLabOrganization(self.token,
                                         'gitmate-test-org/subgroup')
        self.user = GitLabOrganization(self.token, 'gitmate-test-user')
Exemple #3
0
 def setUp(self):
     self.gl = GitLab(GitLabOAuthToken(
         os.environ.get('GITLAB_TEST_TOKEN', '')))
     self.repo_name = 'test/test'
     self.default_data = {
         'project': {
             'path_with_namespace': self.repo_name,
         },
         'object_attributes': {
             'id': 12,
             'iid': 23,
             'action': 'open',
             'noteable_type': 'Issue',
             'target': {
                 'path_with_namespace': 'gitmate-test-user/test'
             }
         },
         'commit': {
             'id': 'bcbb5ec396a2c0f828686f14fac9b80b780504f2',
         },
         'merge_request': {
             'iid': 123,
         },
         'issue': {
             'iid': 123,
             'action': 'open',
         },
         'repository': {
             'git_ssh_url': '[email protected]:gitmate-test-user/test.git'
         }
     }
    def setUp(self):
        self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
        self.repo = GitLabRepository(self.token,
                                     'gitmate-test-user/test')

        self.fork_token = GitLabPrivateToken(os.environ.get('GITLAB_TEST_TOKEN_2', ''))
        self.fork_repo = GitLabRepository(self.fork_token,
                                          'gitmate-test-user/test')
Exemple #5
0
    def get_token(self, raw_token, private_token=False):
        """
        Returns appropriate Token object for the Provider.

        :param raw_token: The token string
        :return: IGitt Token object
        """
        if self.value in ['github', 'github-app']:
            return GitHubToken(raw_token)
        elif self.value == 'gitlab':
            return (GitLabPrivateToken(raw_token)
                    if private_token else GitLabOAuthToken(raw_token))
        else:
            raise NotImplementedError
Exemple #6
0
 def setUp(self):
     super().setUpWithPlugin('ack')
     self.gh_comment_data = {
         'repository': {'full_name': self.repo.full_name, 'id': 49558751},
         'issue': {'number': 7, 'pull_request': {}},
         'comment': {'id': 0},
         'action': 'created'
     }
     self.gh_pr_data = {
         'repository': {'full_name': self.repo.full_name, 'id': 49558751},
         'pull_request': {'number': 7},
         'action': 'opened'
     }
     self.gl_comment_data = {
         'project': {'path_with_namespace': self.gl_repo.full_name},
         'object_attributes': {
             'action': 'open',
             'id': 25,
             'iid': 0,
             'noteable_type': 'MergeRequest'
         },
         'merge_request': {'iid': 25}
     }
     self.gl_pr_data = {
         'object_attributes': {
             'target': {'path_with_namespace': self.gl_repo.full_name},
             'action': 'update',
             'oldrev': 'areallylongrandomshayoudontneedtocareabout',
             'iid': 25
         }
     }
     self.gh_token = GitHubToken(environ['GITHUB_TEST_TOKEN'])
     self.gl_token = GitLabOAuthToken(environ['GITLAB_TEST_TOKEN'])
     self.gh_commit = GitHubCommit(
         self.gh_token, self.repo.full_name,
         'f6d2b7c66372236a090a2a74df2e47f42a54456b')
     self.gh_commit_2 = GitHubCommit(
         self.gh_token, self.repo.full_name,
         '3f2a3b37a2943299c589004c2a5be132e9440cba')
     self.gl_commit = GitLabCommit(
         self.gl_token, self.gl_repo.full_name,
         'f6d2b7c66372236a090a2a74df2e47f42a54456b')
     self.gl_commit_2 = GitLabCommit(
         self.gl_token, self.gl_repo.full_name,
         '3f2a3b37a2943299c589004c2a5be132e9440cba')
Exemple #7
0
 def setUp(self):
     self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     self.commit = GitLabCommit(self.token, 'gitmate-test-user/test',
                                '3fc4b860e0a2c17819934d678decacd914271e5c')
Exemple #8
0
 def test_oauth_token(self):
     oauth_token = GitLabOAuthToken('test')
     self.assertEqual(oauth_token.parameter, {'access_token': 'test'})
     self.assertEqual(oauth_token.value, 'test')
 def setUp(self):
     super().setUpWithPlugin('pr_stale_reminder')
     self.gh_token = GitHubToken(environ['GITHUB_TEST_TOKEN'])
     self.gl_token = GitLabOAuthToken(environ['GITLAB_TEST_TOKEN'])
 def setUp(self):
     self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     self.iss = GitLabIssue(self.token, 'gitmate-test-user/test', 23)
     self.reaction = GitLabReaction(self.token, self.iss, 490941)
Exemple #11
0
 def setUp(self):
     self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     self.notification = GitLabNotification(self.token, '3789039')
Exemple #12
0
 def setUp(self):
     self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     self.user = GitLabUser(self.token)
     self.sils = GitLabUser(self.token, 104269)
Exemple #13
0
 def setUp(self):
     self.token = GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', ''))
     self.mr = GitLabMergeRequest(self.token, 'gitmate-test-user/test', 7)
Exemple #14
0
 def setUp(self):
     self.gl = GitLab(GitLabOAuthToken(os.environ.get('GITLAB_TEST_TOKEN', '')))