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

Python utils.expect函数代码示例

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

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



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

示例1: test_mark

    def test_mark(self):
        self.response('', 205)
        self.patch(self.api)
        self.conf = {'data': {'read': True}}

        expect(self.thread.mark()).is_True()
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:7,代码来源:test_notifications.py


示例2: 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


示例3: test_patch

    def test_patch(self):
        self.response('archive', 200)
        self.get(self.api)
        self.conf.update(headers={'Accept': 'application/vnd.github.patch'})

        expect(self.comp.patch().startswith(b'archive_data')).is_True()
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例4: test_commit

    def test_commit(self):
        self.request.return_value = generate_response('commit')
        sha = '76dcc6cb4b9860034be81b7e58adc286a115aa97'
        self.args = ('GET', self.api + 'commits/' + sha)

        expect(self.repo.commit(sha)).isinstance(github3.repos.RepoCommit)
        self.mock_assertions()
开发者ID:palfrey,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例5: test_gitignore_template

    def test_gitignore_template(self):
        self.response('template')
        self.get('https://api.github.com/gitignore/templates/Python')

        template = self.g.gitignore_template('Python')
        expect(template.startswith('*.py[cod]')).is_True()
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:7,代码来源:test_github.py


示例6: test_iter_subscribers

    def test_iter_subscribers(self):
        self.response('user', _iter=True)
        self.get(self.api + 'subscribers')

        u = next(self.repo.iter_subscribers())
        expect(u).isinstance(github3.users.User)
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例7: test_contents

    def test_contents(self):
        self.request.return_value = generate_response('contents')
        filename = 'setup.py'
        self.args = ('GET', self.api + 'contents/' + filename)

        expect(self.repo.contents(filename)).isinstance(github3.repos.Contents)
        self.mock_assertions()
开发者ID:palfrey,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例8: 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


示例9: test_iter_public_members

    def test_iter_public_members(self):
        self.response('user', _iter=True)
        self.get(self.api + '/public_members')

        expect(next(self.org.iter_public_members())).isinstance(
            github3.users.User)
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:7,代码来源:test_orgs.py


示例10: test_commit_comment

    def test_commit_comment(self):
        self.response("commit_comment")
        comment_id = 1380832
        self.get(self.api + "comments/{0}".format(comment_id))

        expect(self.repo.commit_comment(comment_id)).isinstance(github3.repos.RepoComment)
        self.mock_assertions()
开发者ID:n1k0,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例11: test_contents

    def test_contents(self):
        self.response("contents")
        filename = "setup.py"
        self.get(self.api + "contents/" + filename)

        expect(self.repo.contents(filename)).isinstance(github3.repos.Contents)
        self.mock_assertions()
开发者ID:n1k0,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例12: test_blob

    def test_blob(self):
        self.response("blob")
        sha = "3ceb856e2f14e9669fed6384e58c9a1590a2314f"
        self.get(self.api + "git/blobs/" + sha)

        expect(self.repo.blob(sha)).isinstance(github3.git.Blob)
        self.mock_assertions()
开发者ID:n1k0,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例13: test_set

    def test_set(self):
        self.response('subscription')
        self.put(self.api)
        self.conf = {'data': {'subscribed': True, 'ignored': False}}

        expect(self.subscription.set(True, False)).is_None()
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:7,代码来源:test_notifications.py


示例14: test_subscription

    def test_subscription(self):
        self.response('subscription')
        self.get(self.api + '/subscription')

        expect(self.thread.subscription()).isinstance(
            github3.notifications.Subscription)
        self.mock_assertions()
开发者ID:WheresWardy,项目名称:github3.py,代码行数:7,代码来源:test_notifications.py


示例15: test_iter_milestones

    def test_iter_milestones(self):
        self.response('milestone', _iter=True)
        self.get(self.api + 'milestones')

        m = next(self.repo.iter_milestones())
        expect(m).isinstance(github3.issues.Milestone)
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例16: test_iter_repos

    def test_iter_repos(self):
        self.response('repo', _iter=True)
        self.get(self.api + '/repos')

        expect(next(self.team.iter_repos())).isinstance(
            github3.repos.Repository)
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:7,代码来源:test_orgs.py


示例17: test_iter_network_events

    def test_iter_network_events(self):
        self.response('event', _iter=True)
        self.get(self.api.replace('repos', 'networks', 1) + 'events')

        e = next(self.repo.iter_network_events())
        expect(e).isinstance(github3.events.Event)
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例18: test_patch

    def test_patch(self):
        self.response('archive', 200)
        self.get(self.api)
        self.conf = {'headers': {'Accept': 'application/vnd.github.patch'}}

        expect(self.pull.patch()) != ''
        self.mock_assertions()
开发者ID:Lukasa,项目名称:github3.py,代码行数:7,代码来源:test_pulls.py


示例19: test_commit

    def test_commit(self):
        self.response('commit')
        sha = '76dcc6cb4b9860034be81b7e58adc286a115aa97'
        self.get(self.api + 'commits/' + sha)

        expect(self.repo.commit(sha)).isinstance(github3.repos.RepoCommit)
        self.mock_assertions()
开发者ID:dahlia,项目名称:github3.py,代码行数:7,代码来源:test_repos.py


示例20: test_search_users

    def test_search_users(self):
        self.response('legacy_user')
        self.get('https://api.github.com/{0}/{1}/{2}/{3}'.format(
                 'legacy', 'user', 'search', 'sigmavirus24'))
        self.conf.update({'params': {}})
        users = self.g.search_users('sigmavirus24')
        expect(users[0]).isinstance(github3.legacy.LegacyUser)
        expect(repr(users[0]).startswith('<Legacy User')).is_True()
        self.mock_assertions()

        users = self.g.search_users('sigmavirus24', sort='Foobar')
        self.mock_assertions()

        users = self.g.search_users('sigmavirus24', order='Foobar')
        self.mock_assertions()

        self.conf.update({'params': {'start_page': 2}})
        self.g.search_users('sigmavirus24', 2)
        self.mock_assertions()

        self.conf.update({'params': {'sort': 'joined'}})
        self.g.search_users('sigmavirus24', sort='joined', order='Foobar')
        self.mock_assertions()

        self.conf.update({'params': {'order': 'asc'}})
        self.g.search_users('sigmavirus24', order='asc')
        self.mock_assertions()
开发者ID:dialelo,项目名称:github3.py,代码行数:27,代码来源:test_github.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.generate_response函数代码示例发布时间:2022-05-27
下一篇:
Python utils.dump_json函数代码示例发布时间: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