示例#1
0
    def test_labels_in_issues(self):
        num = mock.create_issue(org, repo, username, token, 'A', 'ala')
        lab_exp = ['lab1', 'lab2']
        mock.set_labels(org, repo, username, token, num, lab_exp)

        issue = mock.get_issue(org, repo, username, token, num)
        lab_act = [label['name'] for label in issue['labels']]

        self.assertEqual(lab_exp, lab_act)
示例#2
0
    def test_label_issue(self):
        num = mock.create_issue(org, repo, username, token, 'A', 'ala')
        lab_exp = ['lab1', 'lab2']
        mock.set_labels(org, repo, username, token, num, lab_exp)

        lab_act = mock.get_labels(org, repo, username, token, num)
        self.assertEqual(lab_exp, lab_act)

        mock.set_labels(org, repo, username, token, num, ['only'])
        only = mock.get_labels(org, repo, username, token, num)
        self.assertEqual(only, ['only'])
示例#3
0
if os.getenv('MOCK'):
    api.new()  # for mocking

issues = yaml.load(open('issues.yml'))

nums = []

for issue in issues:
    num = api.create_issue(org=org,
                           repo=repo,
                           username=username,
                           token=token,
                           title=issue['title'],
                           body=issue['body'])
    nums.append(num)

api.set_labels(org=org,
               repo=repo,
               username=username,
               token=token,
               issue_id=nums[0],
               labels=['in progress', 'good first issue', 'help wanted'])

for num in nums[1:]:
    api.set_labels(org=org,
                   repo=repo,
                   username=username,
                   token=token,
                   issue_id=num,
                   labels=['todo', 'enhancement'])
示例#4
0
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"]

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, user, token, issue_id, label)
	print("Added labels: " + str(labels) + " to issues " + str(issue_id))

示例#5
0
文件: client.py 项目: rdow/robtestprj
config_path = os.path.expanduser("~/repo.yml")

settings = yaml.load(open(config_path))

user = settings["user"]
org = settings["org"]
repo = settings["repo"]
token = settings["token"]
"""
title = "My first client issue"
body = "This was created from the client"
labels = ['todo', 'helpwanted', 'autogenerated']
issue_id = api.create_issue(org, repo, user, token, title, body)
print ( "Created issue: " + str (issue_id ))
api.set_labels(org, repo, user, token, issue_id, labels)

print ("Added labels " + str(labels) + " to  issue " + str(issue_id ))
"""

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))