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)
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))
def test_get_issues(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) self.assertIn(issue1, issues)
from pprint import pprint import requests import githubapimock username = '******' token = 'none' repo = 'githubapimock' githubapimock.new() # for mocking num_1 = githubapimock.create_issue(repo, username, token, 'Xyz', 'xyz') num_2 = githubapimock.create_issue(repo, username, token, 'Omg', 'omg') issues = githubapimock.get_issues(repo, username, token) pprint(issues) githubapimock.close() # for mocking