本文整理汇总了Python中tests.utils.expect函数的典型用法代码示例。如果您正苦于以下问题:Python expect函数的具体用法?Python expect怎么用?Python expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()