desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Fill Rectangle.'
def rectangle(self, rect, attr=None, fill=u' '):
raise NotImplementedError
'write text at current cursor position while watching for scrolling. If the window scrolls because you are at the bottom of the screen buffer, all positions that you are storing will be shifted by the scroll amount. For example, I remember the cursor position of the prompt so that I can redraw the line but if the windo...
def write_scrolling(self, text, attr=None):
raise NotImplementedError
'Return next key press event from the queue, ignoring others.'
def getkeypress(self):
raise NotImplementedError
'Fill the entire screen.'
def page(self, attr=None, fill=' '):
raise NotImplementedError
'Insert text into the command line.'
def insert_text(self, string):
self.l_buffer.insert_text(string)
'motions: lowercase mode is alpha, digit and _, uppercase is delim by spaces w/W: forward short/long word'
def test_motion_word(self):
r = ViModeTest() r._set_line(u'abc_123 def--456.789 x') r.input(u'Escape') r.input(u'"0"') r.input(u'"w"') self.assertEqual(9, r.line_cursor) r.input(u'"w"') self.assertEqual(12, r.line_cursor) r.input(u'"w"') self.assertEqual(14, r.line_cursor) r.input(u'"W"') ...
'motions: lowercase mode is alpha, digit and _, uppercase is delim by spaces e/E: to end of short/long word'
def test_motion_end(self):
r = ViModeTest() r._set_line(u' abc_123 --def--456.789 x') r.input(u'Escape') r.input(u'"0"') r.input(u'"e"') self.assertEqual(8, r.line_cursor) r.input(u'"e"') self.assertEqual(12, r.line_cursor) r.input(u'"e"') self.assertEqual(15, r.line_cursor) r.inpu...
'motions: lowercase mode is alpha, digit and _, uppercase is delim by spaces b/B: backward short/long word'
def test_motion_backward(self):
r = ViModeTest() r._set_line(u'abc_123 def--456.789 x') r.input(u'Escape') r.input(u'"$"') self.assertEqual(23, r.line_cursor) r.input(u'"b"') self.assertEqual(18, r.line_cursor) r.input(u'"b"') self.assertEqual(17, r.line_cursor) r.input(u'"B"') self.assertEqua...
'Return the visible width of the text in line buffer up to position.'
def visible_line_width(self, position=Point):
extra_char_width = len([None for c in self[:position].line_buffer if (8211 <= ord(c) <= 65533)]) return ((len(self[:position].quoted_text()) + (self[:position].line_buffer.count(u' DCTB ') * 7)) + extra_char_width)
'Kills to next word ending'
def kill_word(self):
del self[Point:NextWordEnd]
'Kills to next word ending'
def backward_kill_word(self):
if (not self.delete_selection()): del self[PrevWordStart:Point] self.selection_mark = (-1)
'Kills to next word ending'
def forward_kill_word(self):
if (not self.delete_selection()): del self[Point:NextWordEnd] self.selection_mark = (-1)
'Copy the text in the region to the windows clipboard.'
def copy_region_to_clipboard(self):
if self.enable_win32_clipboard: mark = min(self.mark, len(self.line_buffer)) cursor = min(self.point, len(self.line_buffer)) if (self.mark == (-1)): return begin = min(cursor, mark) end = max(cursor, mark) toclipboard = u''.join(self.line_buffer[begin:end]...
'Copy the text in the region to the windows clipboard.'
def copy_selection_to_clipboard(self):
if (self.enable_win32_clipboard and self.enable_selection and (self.selection_mark >= 0)): selection_mark = min(self.selection_mark, len(self.line_buffer)) cursor = min(self.point, len(self.line_buffer)) if (self.selection_mark == (-1)): return begin = min(cursor, selecti...
'Return the number of lines currently in the history. (This is different from get_history_length(), which returns the maximum number of lines that will be written to a history file.)'
def get_current_history_length(self):
value = len(self.history) log((u'get_current_history_length:%d' % value)) return value
'Return the desired length of the history file. Negative values imply unlimited history file size.'
def get_history_length(self):
value = self._history_length log((u'get_history_length:%d' % value)) return value
'Return the current contents of history item at index (starts with index 1).'
def get_history_item(self, index):
item = self.history[(index - 1)] log((u'get_history_item: index:%d item:%r' % (index, item))) return item.get_line_text()
'Clear readline history.'
def clear_history(self):
self.history[:] = [] self.history_cursor = 0
'Load a readline history file.'
def read_history_file(self, filename=None):
if (filename is None): filename = self.history_filename try: for line in open(filename, u'r'): self.add_history(lineobj.ReadLineTextBuffer(ensure_unicode(line.rstrip()))) except IOError: self.history = [] self.history_cursor = 0
'Save a readline history file.'
def write_history_file(self, filename=None):
if (filename is None): filename = self.history_filename fp = open(filename, u'wb') for line in self.history[(- self.history_length):]: fp.write(ensure_str(line.get_line_text())) fp.write(u'\n') fp.close()
'Append a line to the history buffer, as if it was the last line typed.'
def add_history(self, line):
if (not hasattr(line, 'get_line_text')): line = lineobj.ReadLineTextBuffer(line) if (not line.get_line_text()): pass elif ((len(self.history) > 0) and (self.history[(-1)].get_line_text() == line.get_line_text())): pass else: self.history.append(line) self.history_curs...
'Move back through the history list, fetching the previous command.'
def previous_history(self, current):
if (self.history_cursor == len(self.history)): self.history.append(current.copy()) if (self.history_cursor > 0): self.history_cursor -= 1 current.set_line(self.history[self.history_cursor].get_line_text()) current.point = lineobj.EndOfLine
'Move forward through the history list, fetching the next command.'
def next_history(self, current):
if (self.history_cursor < (len(self.history) - 1)): self.history_cursor += 1 current.set_line(self.history[self.history_cursor].get_line_text())
'Move to the first line in the history.'
def beginning_of_history(self):
self.history_cursor = 0 if (len(self.history) > 0): self.l_buffer = self.history[0]
'Move to the end of the input history, i.e., the line currently being entered.'
def end_of_history(self, current):
self.history_cursor = len(self.history) current.set_line(self.history[(-1)].get_line_text())
'Search forward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. By default, this command is unbound.'
def history_search_forward(self, partial):
q = self._search(1, partial) return q
'Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. By default, this command is unbound.'
def history_search_backward(self, partial):
q = self._search((-1), partial) return q
'Verify that we can retrieve the combined status for a commit.'
def test_status(self):
cassette_name = self.cassette_name('status') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') commit = repository.commit('9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44') combined_status = commit.status() assert isinstance(combin...
'Test the ability to retrieve statuses on a commit.'
def test_statuses(self):
cassette_name = self.cassette_name('statuses') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') commit = repository.commit('29eaea046b353723f80a4810e3f2ea9d16ea6c25') statuses = list(commit.statuses()) for status in statuse...
'Test the ability to retrieve comments on a commit.'
def test_comments(self):
cassette_name = self.cassette_name('comments') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('octocat', 'Hello-World') commit = repository.commit('553c2077f0edc3d5dc5d17262f6aa498e69d6f8e') comments = list(commit.comments()) for comment in comments: ...
'Get the organization for each test.'
def get_organization(self, name='github3py'):
o = self.gh.organization(name) assert isinstance(o, github3.orgs.Organization) return o
'Get the desired team.'
def get_team(self, organization, team_name='Do Not Delete'):
for team in organization.teams(): if (team.name == team_name): break else: assert False, 'Could not find team "{0}"'.format(team_name) return team
'Test the ability to add a member to an organization.'
def test_add_member(self):
self.basic_login() cassette_name = self.cassette_name('add_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() team = self.get_team(o) assert (o.add_member('esacteksab', team.id) is True)
'Test the ability to add a repository to an organization.'
def test_add_repository(self):
self.basic_login() cassette_name = self.cassette_name('add_repository') with self.recorder.use_cassette(cassette_name): o = self.get_organization() team = self.get_team(o) assert (o.add_repository('github3py/urllib3', team.id) is True)
'Test the ability to create a repository in an organization.'
def test_create_repository(self):
self.basic_login() cassette_name = self.cassette_name('create_repository') with self.recorder.use_cassette(cassette_name, **self.betamax_kwargs): o = self.get_organization() r = o.create_repository('test-repository', description='hi') assert isinstance(r, github3.repos.Repository) ...
'Test the ability to conceal a User\'s membership.'
def test_conceal_member(self):
self.basic_login() cassette_name = self.cassette_name('conceal_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() public_member = next(o.public_members()) assert isinstance(public_member, github3.users.ShortUser) assert (o.conceal_member(publ...
'Test the ability to create a new team.'
def test_create_team(self):
self.basic_login() cassette_name = self.cassette_name('create_team') with self.recorder.use_cassette(cassette_name, **self.betamax_kwargs): o = self.get_organization() t = o.create_team('temp-team') assert isinstance(t, github3.orgs.Team) assert (t.delete() is True)
'Test the ability to edit an organization.'
def test_edit(self):
self.basic_login() cassette_name = self.cassette_name('edit') with self.recorder.use_cassette(cassette_name, **self.betamax_kwargs): o = self.get_organization() assert (o.edit(location='Madison, WI') is True)
'Test the ability to check if a User is a member of the org.'
@pytest.mark.xfail((requests.__build__ >= 135424), reason='Requests 2.11.0 breaks our cassettes.') def test_is_member(self):
cassette_name = self.cassette_name('is_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() assert (o.is_member('sigmavirus24') is True)
'Test the ability to check if a User is a public member.'
def test_is_public_member(self):
cassette_name = self.cassette_name('is_public_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() assert (o.is_public_member('defunkt') is False)
'Test retrieving organization\'s complete event stream.'
def test_all_events(self):
self.token_login() cassette_name = self.cassette_name('all_events') with self.recorder.use_cassette(cassette_name): o = self.get_organization('praw-dev') for event in o.all_events(username='bboe'): assert isinstance(event, github3.events.Event)
'Test retrieving an organization\'s public event stream.'
def test_events(self):
cassette_name = self.cassette_name('public_events') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for event in o.events(): assert isinstance(event, github3.events.Event) assert isinstance(event.as_json(), str)
'Test retrieving an organization\'s public event stream.'
def test_public_events(self):
cassette_name = self.cassette_name('public_events') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for event in o.public_events(): assert isinstance(event, github3.events.Event)
'Test the ability to retrieve an organization\'s members.'
def test_members(self):
self.basic_login() cassette_name = self.cassette_name('members') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for member in o.members(): assert isinstance(member, github3.users.ShortUser)
'Test the ability to filter an organization\'s members by their ``"2fa_disabled"`` status. This filter is only available to organization owners.'
@pytest.mark.xfail(reason='sigmavirus24 needs to actually write a test for this.') def test_can_filter_organization_members(self):
self.basic_login() cassette_name = self.cassette_name('members_filters') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for member in o.members(filter='2fa_disabled'): assert isinstance(member, github3.users.ShortUser)
'Test the ability to filter an organization\'s members by role.'
def test_can_filter_members_by_role(self):
self.basic_login() cassette_name = self.cassette_name('members_roles') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for member in o.members(role='all'): assert isinstance(member, github3.users.ShortUser)
'Test the ability to retrieve an organization\'s public members.'
def test_public_members(self):
self.basic_login() cassette_name = self.cassette_name('public_members') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for member in o.public_members(): assert isinstance(member, github3.users.ShortUser)
'Test the ability to retrieve an organization\'s repositories.'
def test_repositories(self):
cassette_name = self.cassette_name('repositories') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for repo in o.repositories(): assert isinstance(repo, github3.repos.Repository)
'Test the ability to retrieve an organization\'s teams.'
def test_teams(self):
self.basic_login() cassette_name = self.cassette_name('teams') with self.recorder.use_cassette(cassette_name): o = self.get_organization() for team in o.teams(): assert isinstance(team, github3.orgs.Team)
'Test the ability to publicize a member of the organization.'
def test_publicize_member(self):
self.basic_login() cassette_name = self.cassette_name('publicize_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() with pytest.raises(github3.GitHubError): o.publicize_member('esacteksab') assert (o.publicize_member('sigmavirus24') is Tr...
'Test the ability to remove a member of the organization.'
def test_remove_member(self):
self.basic_login() cassette_name = self.cassette_name('remove_member') with self.recorder.use_cassette(cassette_name): o = self.get_organization() team = self.get_team(o) assert (o.add_member('gh3test', team.id) is True) assert (o.remove_member('gh3test') is True)
'Test the ability to remove a repository from a team.'
def test_remove_repository(self):
self.basic_login() cassette_name = self.cassette_name('remove_repository') with self.recorder.use_cassette(cassette_name): o = self.get_organization() team = self.get_team(o) assert (o.remove_repository('github3py/urllib3', team.id) is True)
'Test the ability retrieve an individual team by id.'
def test_team(self):
self.basic_login() cassette_name = self.cassette_name('team') with self.recorder.use_cassette(cassette_name): o = self.get_organization() first_team = next(o.teams()) fetched_team = o.team(first_team.id) assert (first_team == fetched_team)
'Show that etag resets to None after refreshing the object.'
def test_resets_etag(self):
cassette_name = self.cassette_name('resets_etag') with self.recorder.use_cassette(cassette_name): users_iter = self.gh.all_users(number=10) assert (users_iter.etag is None) next(users_iter) assert (users_iter.etag is not None) users_iter.refresh() assert (users_it...
'Show that etag gets during iteration.'
def test_catch_etags(self):
cassette_name = self.cassette_name('catch_etags') with self.recorder.use_cassette(cassette_name): users_iter = self.gh.all_users(number=10) assert (users_iter.etag is None) next(users_iter) assert (users_iter.etag is not None)
'Show that StopIteration is raised when response is empty.'
def test_catch_None(self):
cassette_name = self.cassette_name('catch_None') with self.recorder.use_cassette(cassette_name): orgs_iter = self.gh.organizations_with('itsmemattchung') with pytest.raises(StopIteration): next(orgs_iter)
'Tests __iter__ and while loop reaches 0.'
def test_count_reaches_0(self):
cassette_name = self.cassette_name('count_reaches_0') with self.recorder.use_cassette(cassette_name): users_iter = self.gh.all_users(number=1) assert isinstance(next(users_iter), github3.users.ShortUser) with pytest.raises(StopIteration): next(users_iter)
'Test method returns next value.'
def test_next(self):
cassette_name = self.cassette_name('next') with self.recorder.use_cassette(cassette_name): users_iter = self.gh.all_users(number=10) assert isinstance(next(users_iter), github3.users.ShortUser)
'Get the desired organization.'
def get_organization(self, organization='github3py'):
o = self.gh.organization(organization) assert isinstance(o, github3.orgs.Organization) return o
'Get our desired team.'
def get_team(self, organization='github3py', id=189901):
o = self.get_organization(organization) t = o.team(id) assert isinstance(t, github3.orgs.Team) return t
'Show a user can add a member to a team.'
def test_add_member(self):
cassette_name = self.cassette_name('add_member') with self.recorder.use_cassette(cassette_name): team = self.get_team() assert (team.add_member('esacteksab') is True)
'Show that a user can add a repository to a team.'
def test_add_repository(self):
cassette_name = self.cassette_name('add_repository') with self.recorder.use_cassette(cassette_name): team = self.get_team() assert (team.add_repository('github3py/urllib3') is True)
'Show that a user can delete a team.'
def test_delete(self):
cassette_name = self.cassette_name('delete') with self.recorder.use_cassette(cassette_name): o = self.get_organization() t = o.create_team('delete-me') assert isinstance(t, github3.orgs.Team) assert (t.delete() is True)
'Show that a user can edit a team.'
def test_edit(self):
cassette_name = self.cassette_name('edit') with self.recorder.use_cassette(cassette_name): o = self.get_organization() t = o.create_team('edit-me') assert isinstance(t, github3.orgs.Team) assert (t.edit('delete-me', permission='admin') is True) assert (t.name == 'delete-m...
'Show that a user can check of a team has access to a repository.'
def test_has_repository(self):
cassette_name = self.cassette_name('has_repository') with self.recorder.use_cassette(cassette_name): t = self.get_team() assert (t.has_repository('github3py/urllib3') is True)
'Show that a user can check if another user is a team member.'
def test_is_member(self):
cassette_name = self.cassette_name('is_member') with self.recorder.use_cassette(cassette_name): t = self.get_team() assert (t.is_member('sigmavirus24') is True)
'Show that a user can retrieve a team\'s members.'
def test_members(self):
cassette_name = self.cassette_name('members') with self.recorder.use_cassette(cassette_name): t = self.get_team() for member in t.members(): assert isinstance(member, github3.users.ShortUser)
'Test the ability to filter an team\'s members by role.'
def test_can_filter_members_by_role(self):
self.basic_login() cassette_name = self.cassette_name('members_roles') with self.recorder.use_cassette(cassette_name): t = self.get_team() for member in t.members(role='all'): assert isinstance(member, github3.users.ShortUser)
'Show that a user can retrieve a team\'s repositories.'
def test_repositories(self):
cassette_name = self.cassette_name('repositories') with self.recorder.use_cassette(cassette_name): t = self.get_team() for repository in t.repositories(): assert isinstance(repository, github3.repos.Repository)
'Show a user can remove a member from a team.'
def test_remove_member(self):
cassette_name = self.cassette_name('remove_member') with self.recorder.use_cassette(cassette_name): team = self.get_team() assert (team.remove_member('esacteksab') is True)
'Show a user can remove a repository from a team.'
def test_remove_repository(self):
cassette_name = self.cassette_name('remove_repository') with self.recorder.use_cassette(cassette_name): team = self.get_team(id=923595) assert (team.remove_repository('github3py/urllib3') is True)
'Test the ability to add a collaborator to a repository.'
def test_add_collaborator(self):
self.basic_login() cassette_name = self.cassette_name('add_collaborator') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('testgh3', 'collaborators') assert repository assert repository.add_collaborator('sigmavirus24')
'Test the ability to retrieve assignees of issues on a repo.'
def test_assignees(self):
cassette_name = self.cassette_name('assignees') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('kennethreitz', 'requests') assert (repository is not None) for assignee in repository.assignees(): assert isinstance(assignee, github3.users.ShortU...
'Test the ability to retrieve blob on a repository.'
def test_blob(self):
cassette_name = self.cassette_name('blob') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') blob = repository.blob('e1bacfb242c7dee1d24aef52df23d7a3f7442ea3') assert isinstance(blob, github3.git.Blob)
'Test the ability to retrieve a single branch in a repository.'
def test_branch(self):
cassette_name = self.cassette_name('branch') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) branch = repository.branch('develop') assert isinstance(branch, github3.repos.branch.Branch) ...
'Test the ability to retrieve the branches in a repository.'
def test_branches(self):
cassette_name = self.cassette_name('branches') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for branch in repository.branches(): assert isinstance(branch, github3.repos.branch.Bra...
'Test the ability to retrieve protected branches in a repository.'
def test_protected_branches(self):
cassette_name = self.cassette_name('branches_protected') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) assert all(((b.protection['enabled'] is True) for b in repository.branches(protected=True...
'Test the ability to retrieve the code frequency in a repo.'
def test_code_frequency(self):
cassette_name = self.cassette_name('code_frequency') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for code_freq in repository.code_frequency(): assert isinstance(code_freq, list) ...
'Test the ability to retrieve the collaborators on a repository.'
def test_collaborators(self):
cassette_name = self.cassette_name('collaborators') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for collaborator in repository.collaborators(): assert isinstance(collaborator, gi...
'Test the ability to retrieve comments on a repository.'
def test_comments(self):
cassette_name = self.cassette_name('comments') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for comment in repository.comments(): assert isinstance(comment, github3.repos.comment....
'Test the ability to retrieve commit activity on a repo.'
def test_commit_activity(self):
cassette_name = self.cassette_name('commit_activity') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for activity in repository.commit_activity(): assert isinstance(activity, dict)
'Test the ability to retrieve single commit comment.'
def test_commit_comment(self):
cassette_name = self.cassette_name('commit_comment') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') comment = repository.commit_comment(1380832) assert isinstance(comment, github3.repos.comment.RepoComment)
'Test the ability to retrieve commits on a repository.'
def test_commits(self):
cassette_name = self.cassette_name('commits') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for commit in repository.commits(number=25): assert isinstance(commit, github3.repos.com...
'Test the ability to compare two commits.'
def test_compare_commits(self):
cassette_name = self.cassette_name('compare_commits') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') base = 'a811e1a270f65eecb65755eca38d888cbefcb0a7' head = '76dcc6cb4b9860034be81b7e58adc286a115aa97' comparison = rep...
'Test the ability to retrieve contributor statistics for a repo.'
def test_contributor_statistics(self):
cassette_name = self.cassette_name('contributor_statistics') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for stat in repository.contributor_statistics(): assert isinstance(stat, ...
'Test the ability to retrieve the contributors to a repository.'
def test_contributors(self):
cassette_name = self.cassette_name('contributors') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') assert (repository is not None) for contributor in repository.contributors(): assert isinstance(contributor, github...
'Test the ability to create a blob on a repository.'
def test_create_blob(self):
self.token_login() cassette_name = self.cassette_name('create_blob') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') content = 'VGVzdCBibG9i\n' encoding = 'base64' sha = '30f2c645388832f70d37ab2b47eb9ea527e5ae7c'...
'Test the ability to create a comment on a repository.'
def test_create_comment(self):
self.token_login() cassette_name = self.cassette_name('create_comment') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') body = 'Early morning commits are a good idea. It is just me. Me migrati...
'Test the ability to create a commit.'
def test_create_commit(self):
self.token_login() cassette_name = self.cassette_name('create_commit') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') data = {'message': 'My commit message', 'author': {'name': 'Matt Chung', 'email': 'foo@example.com',...
'Show that UnProcessableEntity is raised with empty comitter.'
def test_create_commit_with_empty_committer(self):
self.token_login() cassette_name = self.cassette_name('create_commit_with_empty_committer') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') data = {'message': 'My commit message', 'author': {'name': 'Matt Chung', 'email...
'Test the ability to create an empty blob on a repository.'
def test_create_empty_blob(self):
self.basic_login() cassette_name = self.cassette_name('create_empty_blob') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('github3py', 'fork_this') assert (repository is not None) blob_sha = repository.create_blob('', 'utf-8') assert (blob_sha is ...
'Test the ability to create a deployment for a repository.'
def test_create_deployment(self):
self.basic_login() cassette_name = self.cassette_name('create_deployment') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('adrianmoisey', 'temptest') assert (repository is not None) deployment = repository.create_deployment('adrianmoisey-patch-1') ...
'Test the ability to create a file on a repository.'
def test_create_file(self):
self.token_login() cassette_name = self.cassette_name('create_file') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') data = {'path': 'hello.txt', 'message': 'my commit message', 'content': 'bXkgbmV3IGZpbGUgY29udGVudHM=', '...
'Test the ability to fork a repository.'
def test_create_fork(self):
self.token_login() betamax_kwargs = {'match_requests_on': ['method', 'uri', 'json-body']} cassette_name = self.cassette_name('create_fork') with self.recorder.use_cassette(cassette_name, **betamax_kwargs): repository = self.gh.repository('sigmavirus24', 'github3.py') forked_repo = reposi...
'Test the ability to create a hook for a repository.'
def test_create_hook(self):
self.token_login() cassette_name = self.cassette_name('create_hook') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') data = {'name': 'web', 'config': {'url': 'http://example.com/webhook', 'content_type': 'json'}} hook = ...
'Test the ability to create an issue for a repository.'
def test_create_issue(self):
self.token_login() cassette_name = self.cassette_name('create_issue') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') data = {'title': 'Create Issue Integration Test', 'body': 'Delete me after', 'assignee': 'itsmema...
'Test the ability to create an issue with multiple assignees for a repository.'
def test_create_issue_multiple_assignees(self):
self.token_login() cassette_name = self.cassette_name('create_issue_multiple_assignees') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') data = {'title': 'Create Issue Integration Test', 'body': 'Delete me after', '...
'Test the ability to create an issue with both assignee and assignees.'
def test_create_issue_both_assignee_and_assignees(self):
self.token_login() cassette_name = self.cassette_name('create_issue_both_assignee_and_assignees') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') data = {'title': 'Create Issue Integration Test', 'body': 'Delete me ...
'Test the ability to deploy a key.'
def test_create_key(self):
self.token_login() cassette_name = self.cassette_name('create_key') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('itsmemattchung', 'github3.py') key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZn4/RGE9YQrfjq7wSrYkdtKH3r1rEIkx/4Nv1AG/PqE4AWKSVzKkqhurnqKtctV...
'Test the ability to create a label on a repository.'
def test_create_label(self):
self.token_login() cassette_name = self.cassette_name('create_label') with self.recorder.use_cassette(cassette_name): repository = self.gh.repository('sigmavirus24', 'github3.py') label = repository.create_label('fakelabel', 'fad8c7') assert isinstance(label, github3.issues.label.Label)