def test_close_issue(self): num = mock.create_issue(org, repo, username, token, 'A', 'ala') issue1 = mock.get_issue(org, repo, username, token, num) issues = mock.get_issues(org, repo, username, token) mock.close_issue(org, repo, username, token, num) issue1_closed = mock.get_issue(org, repo, username, token, num) issue1['state'] = 'closed' self.assertEqual(issue1_closed, issue1)
def _menu_close_issue(settings): num = input('Enter issue number to close: ') return api.close_issue( org=settings['org'], repo=settings['repo'], username=settings['user'], token=settings['token'], issue_id=num)
import os import yaml import githubapimock as api config_path = os.path.expanduser("~/repo.yml") settings = yaml.load(open(config_path)) org = settings["org"] repo = settings["repo"] user = settings["user"] token = settings["token"] all_issues = api.get_issues(org, repo, user, token) for issue in all_issues: number = issue["number"] print(number) api.close_issue(org, repo, user, token, number) print("Closing issue: " + str(number))
title = "" while title != "q": title = input("Title: ") body = input("Body: ") label = input("Label: ") labels = [label] issue_id = api.create_issue(org, repo, user, token, title, body) print ( "Created issue: " + str (issue_id ) + " in " + org + "/" + repo) api.set_labels(org, repo, user, token, issue_id, labels) print ( "Added labels " + str(labels) + " to issue " + str(issue_id) ) """ all_issues = api.get_issues(org, repo, user, token) for issue in all_issues: print("Closing " + str(issue["number"])) api.close_issue(org, repo, user, token,issue["number"])