desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Show that an authenticated user can iterate over their emails.'
| def test_emails(self):
| i = self.instance.emails()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/emails'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate over their followers.'
| def test_followers(self):
| i = self.instance.followers()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/followers'), params={'per_page': 100}, headers={})
|
'Show that one needs to authenticate to use #followers.'
| def test_followers_require_auth(self):
| self.session.has_auth.return_value = False
with pytest.raises(GitHubError):
self.instance.followers()
|
'Show that one can authenticate over the followers of a user.'
| def test_followers_of(self):
| i = self.instance.followers_of('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/followers'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate the users they are
following.'
| def test_following(self):
| i = self.instance.following()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/following'), params={'per_page': 100}, headers={})
|
'Show that one needs to authenticate to use #following.'
| def test_following_require_auth(self):
| self.session.has_auth.return_value = False
with pytest.raises(GitHubError):
self.instance.following()
|
'Show that one can authenticate over the users followed by another.'
| def test_followed_by(self):
| i = self.instance.followed_by('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/following'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate over their gists.'
| def test_gists(self):
| i = self.instance.gists()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('gists'), params={'per_page': 100}, headers={})
|
'Show that an user\'s gists can be iterated over.'
| def test_gists_by(self):
| i = self.instance.gists_by('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/gists'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate over their issues.'
| def test_issues(self):
| i = self.instance.issues()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('issues'), params={'per_page': 100}, headers={})
|
'Show that issues can be filtered.'
| def test_issues_with_params(self):
| params = {'filter': 'assigned', 'state': 'closed', 'labels': 'bug', 'sort': 'created', 'direction': 'asc', 'since': '2012-05-20T23:10:27Z'}
p = {'per_page': 100}
p.update(params)
i = self.instance.issues(**params)
self.get_next(i)
self.session.get.assert_called_once_with(url_for('issues'), param... |
'Show that an authenticated user can iterate over their public keys.'
| def test_keys(self):
| i = self.instance.keys()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/keys'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate over their notifications.'
| def test_notifications(self):
| i = self.instance.notifications()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('notifications'), params={'per_page': 100}, headers={})
|
'Show that the user can filter by pariticpating.'
| def test_notifications_participating_in(self):
| i = self.instance.notifications(participating=True)
self.get_next(i)
self.session.get.assert_called_once_with(url_for('notifications'), params={'per_page': 100, 'participating': 'true'}, headers={})
|
'Show that the user can iterate over all of their notifications.'
| def test_notifications_all(self):
| i = self.instance.notifications(all=True)
self.get_next(i)
self.session.get.assert_called_once_with(url_for('notifications'), params={'per_page': 100, 'all': 'true'}, headers={})
|
'Show that one can iterate over an organization\'s issues.'
| def test_organization_issues(self):
| i = self.instance.organization_issues('org')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('orgs/org/issues'), params={'per_page': 100}, headers={})
|
'Show that one can pass parameters to #organization_issues.'
| def test_organization_issues_with_params(self):
| params = {'filter': 'assigned', 'state': 'closed', 'labels': 'bug', 'sort': 'created', 'direction': 'asc', 'since': '2012-05-20T23:10:27Z'}
i = self.instance.organization_issues('org', **params)
self.get_next(i)
p = {'per_page': 100}
p.update(params)
self.session.get.assert_called_once_with(url_... |
'Show that one can iterate over all of the authenticated user\'s orgs.'
| def test_organizations(self):
| i = self.instance.organizations()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/orgs'), params={'per_page': 100}, headers={})
|
'Show that one can iterate over all of a user\'s orgs.'
| def test_organizations_with(self):
| i = self.instance.organizations_with('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/orgs'), params={'per_page': 100}, headers={})
|
'Show that all public gists can be iterated over.'
| def test_public_gists(self):
| i = self.instance.public_gists()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('gists/public'), params={'per_page': 100}, headers={})
|
'Show that an authenticated user can iterate over their repositories.'
| def test_respositories(self):
| i = self.instance.repositories()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/repos'), params={'per_page': 100}, headers={})
|
'Show that an #repositories accepts params.'
| def test_respositories_accepts_params(self):
| i = self.instance.repositories(type='all', direction='desc', sort='created')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/repos'), params={'per_page': 100, 'type': 'all', 'direction': 'desc', 'sort': 'created'}, headers={})
|
'Show that a user can iterate over a repository\'s issues.'
| def test_issues_on(self):
| i = self.instance.issues_on('owner', 'repo')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('repos/owner/repo/issues'), params={'per_page': 100}, headers={})
|
'Show that #issues_on accepts multiple parameters.'
| def test_issues_on_with_params(self):
| params = {'milestone': 1, 'state': 'all', 'assignee': 'owner', 'mentioned': 'someone', 'labels': 'bug,high'}
i = self.instance.issues_on('owner', 'repo', **params)
self.get_next(i)
params.update(per_page=100)
self.session.get.assert_called_once_with(url_for('repos/owner/repo/issues'), params=params,... |
'Show that one can iterate over an authenticated user\'s stars.'
| def test_starred(self):
| i = self.instance.starred()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/starred'), params={'per_page': 100}, headers={})
|
'Show that one can iterate over a user\'s stars.'
| def test_starred_by(self):
| i = self.instance.starred_by('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/starred'), params={'per_page': 100}, headers={})
|
'Show that one can iterate over an authenticated user\'s subscriptions.'
| def test_subscriptions(self):
| i = self.instance.subscriptions()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/subscriptions'), params={'per_page': 100}, headers={})
|
'Show that one can iterate over a user\'s subscriptions.'
| def test_subscriptions_for(self):
| i = self.instance.subscriptions_for('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/subscriptions'), params={'per_page': 100}, headers={})
|
'Test that one can iterate over a user\'s issues.'
| def test_user_issues(self):
| i = self.instance.user_issues()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/issues'), params={'per_page': 100}, headers={})
|
'Test that one may pass parameters to GitHub#user_issues.'
| def test_user_issues_with_parameters(self):
| params = {'filter': 'assigned', 'state': 'closed', 'labels': 'bug', 'sort': 'created', 'direction': 'asc', 'since': '2012-05-20T23:10:27Z', 'per_page': 25}
i = self.instance.user_issues(**params)
self.get_next(i)
self.session.get.assert_called_once_with(url_for('user/issues'), params=params, headers={})... |
'Test that one can iterate over a user\'s repositories.'
| def test_repositories_by(self):
| i = self.instance.repositories_by('sigmavirus24')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/repos'), params={'per_page': 100}, headers={})
|
'Test that one can iterate over a user\'s repositories with a type.'
| def test_repositories_by_with_type(self):
| i = self.instance.repositories_by('sigmavirus24', 'all')
self.get_next(i)
self.session.get.assert_called_once_with(url_for('users/sigmavirus24/repos'), params={'per_page': 100, 'type': 'all'}, headers={})
|
'Verify a user must be authenticated to add email addresses.'
| def test_add_email_addresses(self):
| self.assert_requires_auth(self.instance.add_email_addresses, [])
|
'A user must be authenticated to retrieve an authorization.'
| def test_authorization(self):
| self.assert_requires_auth(self.instance.authorization, 1)
|
'Show that one needs to authenticate to use #authorizations.'
| def test_authorizations(self):
| self.assert_requires_auth(self.instance.authorizations)
|
'Show that GitHub#create_issue requires auth.'
| def test_create_issue(self):
| self.assert_requires_auth(self.instance.create_issue, 'owner', 'repo', 'title')
|
'Show that GitHub#create_key requires auth.'
| def test_create_key(self):
| self.assert_requires_auth(self.instance.create_key, 'title', 'key')
|
'Show that GitHub#create_repository requires auth.'
| def test_create_repository(self):
| self.assert_requires_auth(self.instance.create_repository, 'repo')
|
'Verify a user must be authenticated to delete email addresses.'
| def test_delete_email_addresses(self):
| self.assert_requires_auth(self.instance.delete_email_addresses, [])
|
'Show that one needs to authenticate to use #emails.'
| def test_emails(self):
| self.assert_requires_auth(self.instance.emails)
|
'Show that one needs to authenticate to use #feeds.'
| def test_feeds(self):
| self.assert_requires_auth(self.instance.feeds)
|
'Show that one needs to authenticate to use #follow.'
| def test_follow(self):
| self.assert_requires_auth(self.instance.follow, 'foo')
|
'Show that one needs to authenticate to use #gists.'
| def test_gists(self):
| self.assert_requires_auth(self.instance.gists)
|
'Show that GitHub#is_following requires authentication.'
| def test_is_following(self):
| self.assert_requires_auth(self.instance.is_following, 'foo')
|
'Show that GitHub#is_starred requires authentication.'
| def test_is_starred(self):
| self.assert_requires_auth(self.instance.is_starred, 'foo', 'bar')
|
'Show that one needs to authenticate to use #issues.'
| def test_issues(self):
| self.assert_requires_auth(self.instance.issues)
|
'Show that retrieving user key requires authentication.'
| def test_key(self):
| self.assert_requires_auth(self.instance.key, 1)
|
'Show that one needs to authenticate to use #keys.'
| def test_keys(self):
| self.assert_requires_auth(self.instance.keys)
|
'Show that GitHub#me requires authentication.'
| def test_me(self):
| self.assert_requires_auth(self.instance.me)
|
'Show that one needs to authenticate to use #gists.'
| def test_notifications(self):
| self.assert_requires_auth(self.instance.notifications)
|
'Show that one needs to authenticate to use #organization_issues.'
| def test_organization_issues(self):
| self.assert_requires_auth(self.instance.organization_issues, 'org')
|
'Show that one needs to authenticate to use #organizations.'
| def test_organizations(self):
| self.assert_requires_auth(self.instance.organizations)
|
'Show that one needs to authenticate to use pull request.'
| def test_pubsubhubbub(self):
| self.assert_requires_auth(self.instance.pubsubhubbub, mode='', topic='', callback='')
|
'Show that one needs to authenticate to use #repositories.'
| def test_repositories(self):
| self.assert_requires_auth(self.instance.repositories)
|
'Show that starring a repository requires authentication.'
| def test_star(self):
| self.assert_requires_auth(self.instance.star, username='', repo='')
|
'Show that one needs to authenticate to use #starred.'
| def test_starred(self):
| self.assert_requires_auth(self.instance.starred)
|
'Show that unfollowing a user requires authentication.'
| def test_unfollow(self):
| self.assert_requires_auth(self.instance.unfollow, 'foo')
|
'Show that unstarring requires authentication.'
| def test_unstar(self):
| self.assert_requires_auth(self.instance.unstar, username='', repo='')
|
'Show that GitHub#user_issues requires authentication.'
| def test_user_issues(self):
| self.assert_requires_auth(self.instance.user_issues)
|
'Test that GitHub#revoke_authorization calls the expected methods.
It should use the session\'s delete and temporary_basic_auth methods.'
| def test_revoke_authorization(self):
| self.instance.revoke_authorization('access_token')
self.session.delete.assert_called_once_with('https://api.github.com/applications/id/tokens/access_token', params={'client_id': None, 'client_secret': None})
self.session.temporary_basic_auth.assert_called_once_with('id', 'secret')
|
'Test that GitHub#revoke_authorizations calls the expected methods.
It should use the session\'s delete and temporary_basic_auth methods.'
| def test_revoke_authorizations(self):
| self.instance.revoke_authorizations()
self.session.delete.assert_called_once_with('https://api.github.com/applications/id/tokens', params={'client_id': None, 'client_secret': None})
self.session.temporary_basic_auth.assert_called_once_with('id', 'secret')
|
'Verify the request for checking admin stats.'
| def test_admin_stats(self):
| self.instance.admin_stats(option='all')
self.session.get.assert_called_once_with(enterprise_url_for('enterprise/stats/all'))
|
'Show that instance string is formatted correctly.'
| def test_str(self):
| assert (str(self.instance) == '<GitHub Enterprise [{0}]>'.format(enterprise_url_for()))
|
'Verify the request for /api.'
| def test_api(self):
| with helper.mock.patch.object(GitHubStatus, '_recipe') as _recipe:
self.instance.api()
_recipe.assert_called_once_with('api.json')
|
'Verify the request for /api/last-message.'
| def test_last_message(self):
| with helper.mock.patch.object(GitHubStatus, '_recipe') as _recipe:
self.instance.last_message()
_recipe.assert_called_once_with('api', 'last-message.json')
|
'Verify the request for /api/messages.'
| def test_messages(self):
| with helper.mock.patch.object(GitHubStatus, '_recipe') as _recipe:
self.instance.messages()
_recipe.assert_called_once_with('api', 'messages.json')
|
'Verify the request for /api/status.'
| def test_status(self):
| with helper.mock.patch.object(GitHubStatus, '_recipe') as _recipe:
self.instance.status()
_recipe.assert_called_once_with('api', 'status.json')
|
'Show that instance string is formatted properly.'
| def test_repr(self):
| assert repr(self.instance).startswith('<Event')
|
'Show that an event contains sorted payload handlers.'
| def test_list_types(self):
| (Event, handlers) = (github3.events.Event, github3.events._payload_handlers)
assert (Event.list_types() == sorted(handlers.keys()))
|
'Show that an event contains an organization instance.'
| def test_org(self):
| json = self.instance.as_dict().copy()
org = get_org_example_data()
json['org'] = org
event = github3.events.Event(json)
assert isinstance(event.org, github3.orgs.Organization)
|
'Show that the event type is a RepoComment.'
| def test_commitcomment(self):
| comment = {'comment': get_comment_example_data()}
comment = github3.events._commitcomment(comment, None)
assert isinstance(comment['comment'], github3.repos.comment.RepoComment)
|
'Show that the event type is a FollowEvent.'
| def test_follow(self):
| follower = {'target': get_user_example_data()}
github3.events._follow(follower, None)
assert isinstance(follower['target'], github3.events.EventUser)
|
'Show that the event type is a ForkEvent.'
| def test_forkev(self):
| forkee = {'forkee': get_repo_example_data()}
github3.events._forkev(forkee, None)
assert isinstance(forkee['forkee'], github3.repos.Repository)
|
'Show that the event type is a GistEvent.'
| def test_gist(self):
| gist = {'gist': get_gist_example_data()}
github3.events._gist(gist, None)
assert isinstance(gist['gist'], github3.gists.Gist)
|
'Show that the event type is a IssueCommentEvent.'
| def test_issuecomm(self):
| comment = {'issue': get_issue_example_data(), 'comment': get_comment_example_data()}
github3.events._issuecomm(comment, None)
assert isinstance(comment['issue'], github3.issues.Issue)
assert isinstance(comment['comment'], github3.issues.comment.IssueComment)
|
'Show that the event type is a IssueEvent.'
| def test_issueevent(self):
| comment = {'issue': get_issue_example_data()}
github3.events._issueevent(comment, None)
assert isinstance(comment['issue'], github3.issues.Issue)
|
'Show that the event type is a MemberEvent.'
| def test_member(self):
| member = {'member': get_user_example_data()}
github3.events._member(member, None)
assert isinstance(member['member'], github3.events.EventUser)
|
'Show that the event type is a PullRequestEvent.'
| def test_pullreqev(self):
| pull_request = {'pull_request': get_pull_request_example_data()}
github3.events._pullreqev(pull_request, None)
assert isinstance(pull_request['pull_request'], github3.pulls.PullRequest)
|
'Show that the event type is a PullRequestReviewCommentEvent.'
| def test_pullreqcomment(self):
| pull_request = {'comment': get_comment_example_data()}
github3.events._pullreqcomm(pull_request, None)
assert isinstance(pull_request['comment'], github3.pulls.ReviewComment)
|
'Show that the event type is a TeamAddEvent.'
| def test_team(self):
| team = {'team': get_team_example_data(), 'repo': get_repo_example_data(), 'user': get_user_example_data()}
github3.events._team(team, None)
assert isinstance(team['team'], github3.orgs.Team)
assert isinstance(team['repo'], github3.repos.Repository)
|
'Show that instance is formatted as a string when printed.'
| def test_repr(self):
| assert isinstance(repr(self.instance), str)
|
'Show that a user can delete a subscription.'
| def test_delete(self):
| self.instance.delete()
self.session.delete.assert_called_once_with(url_for())
|
'Show that subscription is ignored.'
| def test_is_ignored(self):
| (self.instance.is_ignored() == self.instance.ignored)
|
'Show that subscription is subscribed.'
| def test_is_subscription(self):
| (self.instance.is_subscribed() == self.instance.subscribed)
|
'Show that a user can set a subscription.'
| def test_set(self):
| self.instance._update_attributes = (lambda *args: None)
self.instance.set(True, False)
self.put_called_with(url_for(), data={'ignored': False, 'subscribed': True})
|
'Test that deleting milestone requires authentication.'
| def test_delete(self):
| self.assert_requires_auth(self.instance.delete)
|
'Test that updating a milestone requires authentication.'
| def test_update(self):
| data = {'title': 'foo', 'state': 'closed', 'description': ':sparkles:', 'due_on': '2013-12-31T23:59:59Z'}
self.assert_requires_auth(self.instance.update, **data)
|
'Test the request for deleting a milestone.'
| def test_delete(self):
| self.instance.delete()
assert self.session.delete.called
|
'Show that creator is None when json attribute is set to None.'
| def test_none_creator(self):
| json = self.instance.as_dict().copy()
json['creator'] = None
milestone = github3.issues.milestone.Milestone(json)
assert (milestone.creator is None)
|
'Show that due on attribute is a datetime object.'
| def test_due_on(self):
| json = self.instance.as_dict().copy()
json['due_on'] = '2012-12-31T23:59:59Z'
milestone = github3.issues.milestone.Milestone(json)
assert isinstance(milestone.due_on, datetime.datetime)
|
'Show that instance string is formatted properly.'
| def test_repr(self):
| assert (repr(self.instance) == '<Milestone [v1.0]>')
|
'Show that str(milestone) is the same as milestone\'s title.'
| def test_str(self):
| assert (str(self.instance) == 'v1.0')
|
'Show that id of instance is returned correctly.'
| def test_id(self):
| assert (self.instance.id == 1002604)
|
'Test the request for updating a milestone.'
| def test_update(self):
| data = {'title': 'foo', 'state': 'closed', 'description': ':sparkles:', 'due_on': '2013-12-31T23:59:59Z'}
self.instance.update(**data)
self.patch_called_with(url_for(), data=data)
|
'Show request is not made when update is called with no arguments.'
| def test_update_no_parameters(self):
| self.instance.update()
assert (self.session.post.called is False)
|
'Test the request to retrieve labels associated with a milestone.'
| def test_labels(self):
| i = self.instance.labels()
self.get_next(i)
self.session.get.assert_called_once_with(url_for('labels'), params={'per_page': 100}, headers={})
|
'Show that a user can create a comment.'
| def test_create_comment(self):
| self.instance.create_comment('some comment text')
self.post_called_with(url_for('comments'), data={'body': 'some comment text'})
|
'Show that a user cannot create an empty comment.'
| def test_create_comment_requires_a_body(self):
| self.instance.create_comment(None)
assert (self.session.post.called is False)
|
'Show that a user can delete a gist.'
| def test_delete(self):
| self.instance.delete()
self.session.delete.assert_called_once_with(url_for())
|
'Show that a user can edit a gist.'
| def test_edit(self):
| desc = 'description'
files = {'file': {'content': 'foo content bar'}}
self.instance.edit(desc, files)
self.patch_called_with(url_for(), data={desc: desc, 'files': files})
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.