• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python expect.githuberror函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.utils.expect.githuberror函数的典型用法代码示例。如果您正苦于以下问题:Python githuberror函数的具体用法?Python githuberror怎么用?Python githuberror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了githuberror函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_update

    def test_update(self):
        self.response('repo_comment', 200)
        self.post(self.api)
        data = {
            'body': 'This is a comment body',
            'sha': 'fakesha', 'line': 1, 'position': 1,
            'path': 'github3/repos.py',
        }
        self.conf = {'data': data.copy()}
        self.conf['data']['commit_id'] = self.conf['data']['sha']
        del(self.conf['data']['sha'])

        with expect.githuberror():
            self.comment.update('foo', 'bar', 'bogus', 'jargon', 'files')

        self.login()
        expect(self.comment.update(None, 'f', 'o', 1, 1)).is_False()
        expect(self.comment.update('f', None, 'o', 1, 1)).is_False()
        expect(self.comment.update('f', 'o', 1, None, 1)).is_False()
        expect(self.comment.update('f', 'o', 0, 'o', 1)).is_False()
        expect(self.comment.update('f', 'o', 1, 'o', 0)).is_False()
        self.not_called()

        expect(self.comment.update(**data)).is_True()
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:25,代码来源:test_repos.py


示例2: test_create_tag

    def test_create_tag(self):
        self.response('tag', 201)
        self.post(self.api + 'git/tags')
        data = {
            'tag': '0.3', 'message': 'Fake message', 'object': 'fakesha',
            'type': 'commit', 'tagger': {
                'name': 'Ian Cordasco', 'date': 'Not a UTC date',
                'email': '[email protected]'
            }
        }
        self.conf = {'data': data.copy()}
        data['obj_type'] = data['type']
        data['sha'] = data['object']
        del(data['type'], data['object'])

        with expect.githuberror():
            self.repo.create_tag(None, None, None, None, None)

        self.login()
        with patch.object(github3.repos.Repository, 'create_ref'):
            expect(self.repo.create_tag(None, None, None, None,
                                        None)).is_None()
            tag = self.repo.create_tag(**data)
            expect(tag).isinstance(github3.git.Tag)
            expect(repr(tag).startswith('<Tag')).is_True()
        self.mock_assertions()

        with patch.object(github3.repos.Repository, 'create_ref') as cr:
            self.repo.create_tag('tag', '', 'fakesha', '', '',
                                 lightweight=True)
            cr.assert_called_once_with('refs/tags/tag', 'fakesha')
开发者ID:dahlia,项目名称:github3.py,代码行数:31,代码来源:test_repos.py


示例3: test_boolean

    def test_boolean(self):
        r = requests.Response()
        r.status_code = 512
        r.raw = BytesIO('{}'.encode() if is_py3 else '{}')

        with expect.githuberror():
            self.g._boolean(r, 200, 404)
开发者ID:WheresWardy,项目名称:github3.py,代码行数:7,代码来源:test_models.py


示例4: test_create_issue

    def test_create_issue(self):
        self.request.return_value = generate_response('issue', 201)
        title = 'Construct _api attribute on our own'
        self.args = ('POST', self.api + 'issues')
        self.conf = {'data': {'title': title}}

        with expect.githuberror():
            self.repo.create_issue(title)

        self.login()
        expect(self.repo.create_issue(None)).is_None()
        expect(self.repo.create_issue(title)).isinstance(github3.issues.Issue)
        self.mock_assertions()

        body = 'Fake body'
        #self.conf['data'].update(body=body)
        expect(self.repo.create_issue(title, body)
               ).isinstance(github3.issues.Issue)
        self.mock_assertions()

        assignee, mile, labels = 'sigmavirus24', 1, ['bug', 'enhancement']
        #self.conf['data'].update({'assignee': assignee, 'milestone': mile,
        #                          'labels': labels})
        expect(self.repo.create_issue(title, body, assignee, mile, labels)
               ).isinstance(github3.issues.Issue)
        self.mock_assertions()
开发者ID:palfrey,项目名称:github3.py,代码行数:26,代码来源:test_repos.py


示例5: test_pubsubhubbub

    def test_pubsubhubbub(self):
        self.response('', 204)
        self.post('https://api.github.com/hub')
        body = [('hub.mode', 'subscribe'),
                ('hub.topic', 'https://github.com/foo/bar/events/push'),
                ('hub.callback', 'https://localhost/post')]
        self.conf = {}

        with expect.githuberror():
            self.g.pubsubhubbub('', '', '')

        self.login()
        expect(self.g.pubsubhubbub('', '', '')).is_False()
        self.not_called()

        expect(self.g.pubsubhubbub('foo', 'https://example.com', 'foo')
               ).is_False()
        self.not_called()

        d = dict([(k[4:], v) for k, v in body])
        expect(self.g.pubsubhubbub(**d)).is_True()
        _, kwargs = self.request.call_args
        expect('data').is_in(kwargs)
        expect(body) == kwargs['data']
        self.mock_assertions()

        d['secret'] = 'secret'
        body.append(('hub.secret', 'secret'))
        expect(self.g.pubsubhubbub(**d)).is_True()
        _, kwargs = self.request.call_args
        expect('data').is_in(kwargs)
        expect(body) == kwargs['data']
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:33,代码来源:test_github.py


示例6: test_create_repo

    def test_create_repo(self):
        self.response('repo', 201)
        self.post(self.api + '/repos')
        self.conf = {
            'data': {
                'name': 'repo',
                'description': 'desc',
                'homepage': '',
                'private': False,
                'has_issues': True,
                'has_wiki': True,
                'has_downloads': True,
                'auto_init': False,
                'team_id': 1,
                'gitignore_template': '',
            }
        }

        with expect.githuberror():
            self.org.create_repo(None)

        self.not_called()
        self.login()
        expect(self.org.create_repo('repo', 'desc', team_id=1)).isinstance(
            github3.repos.Repository)
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:26,代码来源:test_orgs.py


示例7: test_edit

    def test_edit(self):
        self.response('hook', 200)
        self.patch(self.api)
        data = {
            'name': 'hookname',
            'config': {'push': 'http://example.com'},
            'events': ['push'],
            'add_events': ['fake_ev'],
            'rm_events': ['fake_ev'],
            'active': True,
        }
        self.conf = {'data': data.copy()}
        self.conf['data']['remove_events'] = data['rm_events']
        del(self.conf['data']['rm_events'])

        with expect.githuberror():
            self.hook.edit(**data)

        self.login()
        expect(self.hook.edit(None, None, None)).is_False()
        expect(self.hook.edit('True', None, None)).is_False()
        expect(self.hook.edit(None, 'True', None)).is_False()
        expect(self.hook.edit(None, None, {})).is_False()
        self.not_called()

        expect(self.hook.edit(**data)).is_True()
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:27,代码来源:test_repos.py


示例8: test_update

    def test_update(self):
        self.response('authorization', 200)
        self.post(self.api)
        data = {
            'scopes': ['user']
        }
        self.conf = {'data': data}

        with expect.githuberror():
            self.auth.update()

        def sub_test():
            expect(self.auth.update(**data)).is_True()
            self.mock_assertions()

        self.login()
        expect(self.auth.update()).is_False()
        self.not_called()

        sub_test()

        del(data['scopes'])
        data['add_scopes'] = ['repo']
        sub_test()

        del(data['add_scopes'])
        data['rm_scopes'] = ['user']
        self.conf['data'] = {'remove_scopes': ['user']}
        sub_test()
        self.conf['data'] = data

        del(data['rm_scopes'])
        data['note'] = 'GitHub API'
        data['note_url'] = 'http://example.com'
        sub_test()
开发者ID:Lukasa,项目名称:github3.py,代码行数:35,代码来源:test_auths.py


示例9: test_delete_email_address

    def test_delete_email_address(self):
        with expect.githuberror():
            self.user.delete_email_address('foo')

        self.not_called()
        self.login()
        with patch.object(github3.users.User, 'delete_email_addresses') as p:
            self.user.delete_email_address('foo')
            p.assert_called_once_with(['foo'])
开发者ID:dialelo,项目名称:github3.py,代码行数:9,代码来源:test_users.py


示例10: test_reopen

    def test_reopen(self):
        with expect.githuberror():
            self.pull.reopen()

        self.login()
        with patch.object(github3.pulls.PullRequest, 'update') as up:
            self.pull.reopen()
            up.assert_called_once_with(
                self.pull.title, self.pull.body, 'open')
开发者ID:Lukasa,项目名称:github3.py,代码行数:9,代码来源:test_pulls.py


示例11: test_star

    def test_star(self):
        self.response('', 204)
        self.put(self.api)

        with expect.githuberror():
            self.gist.star()

        self.not_called()
        self.login()
        expect(self.gist.star()).is_True()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:10,代码来源:test_gists.py


示例12: test_delete

    def test_delete(self):
        self.response('', 204)
        self.delete(self.api)

        with expect.githuberror():
            self.l.delete()

        self.not_called()
        self.login()
        expect(self.l.delete()).is_True()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:10,代码来源:test_issues.py


示例13: test_remove_all_labels

    def test_remove_all_labels(self):
        with expect.githuberror():
            self.i.remove_all_labels()

        self.login()

        with patch.object(github3.issues.Issue, 'replace_labels') as rl:
            rl.return_value = []
            expect(self.i.remove_all_labels()) == []
            rl.assert_called_once_with([])
开发者ID:WheresWardy,项目名称:github3.py,代码行数:10,代码来源:test_issues.py


示例14: test_remove_label

    def test_remove_label(self):
        self.response('', 204)
        self.delete(self.api + '/labels/name')

        with expect.githuberror():
            self.i.remove_label('name')

        self.not_called()
        self.login()
        expect(self.i.remove_label('name')).is_True()
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:11,代码来源:test_issues.py


示例15: test_iter_teams

    def test_iter_teams(self):
        self.response('team', _iter=True)
        self.get(self.api + '/teams')

        with expect.githuberror():
            self.org.iter_teams()

        self.not_called()
        self.login()
        expect(next(self.org.iter_teams())).isinstance(github3.orgs.Team)
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:11,代码来源:test_orgs.py


示例16: test_remove_member

    def test_remove_member(self):
        self.response('', 404)
        self.delete(self.api + '/members/user')

        with expect.githuberror():
            self.org.remove_member(None)

        self.not_called()
        self.login()
        expect(self.org.remove_member('user')).is_False()
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:11,代码来源:test_orgs.py


示例17: test_remove_repo

    def test_remove_repo(self):
        self.response('', 204)
        self.delete(self.api + '/repos/repo')

        with expect.githuberror():
            self.team.remove_repo(None)

        self.not_called()
        self.login()
        expect(self.team.remove_repo('repo')).is_True()
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:11,代码来源:test_orgs.py


示例18: test_iter_keys

    def test_iter_keys(self):
        self.response('key', _iter=True)
        self.get(self.api + 'keys')

        with expect.githuberror():
            self.repo.iter_keys()

        self.login()
        k = next(self.repo.iter_keys())
        expect(k).isinstance(github3.users.Key)
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:11,代码来源:test_repos.py


示例19: test_delete

    def test_delete(self):
        self.response('', 204)
        self.delete(self.api[:-1])
        self.conf = {}

        with expect.githuberror():
            self.repo.delete()

        self.login()
        expect(self.repo.delete()).is_True()
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:11,代码来源:test_repos.py


示例20: test_close

    def test_close(self):
        with expect.githuberror():
            self.pull.close()

        self.login()

        with patch.object(github3.pulls.PullRequest, 'update') as up:
            up.return_value = True
            expect(self.pull.close()).is_True()
            up.assert_called_once_with(
                self.pull.title, self.pull.body, 'closed')
开发者ID:Lukasa,项目名称:github3.py,代码行数:11,代码来源:test_pulls.py



注:本文中的tests.utils.expect.githuberror函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python grammar.get_record_grammar函数代码示例发布时间:2022-05-27
下一篇:
Python utils.Rule类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap