def main(): module = AnsibleModule( argument_spec=dict( organization=dict(required=True), repo=dict(required=True), issue=dict(required=True), action=dict(required=False, choices=['get_status']), ), supports_check_mode=True, ) if not HAS_GITHUB_PACKAGE: module.fail_json(msg="Missing required github3 module. (check docs or " "install with: pip install github3.py==1.0.0a4)") organization = module.params['organization'] repo = module.params['repo'] issue = module.params['issue'] action = module.params['action'] result = dict() gh_obj = github3.issue(organization, repo, issue) if isinstance(gh_obj, github3.null.NullObject): module.fail_json(msg="Failed to get details about issue specified. " "Please check organization, repo and issue " "details and try again.") if action == 'get_status' or action is None: if module.check_mode: result.update(changed=True) else: result.update(changed=True, issue_status=gh_obj.state) module.exit_json(**result)
def main(): module = AnsibleModule( argument_spec=dict( organization=dict(required=True), repo=dict(required=True), issue=dict(required=True), action=dict(required=False, choices=['get_status']), ), supports_check_mode=True, ) if not HAS_GITHUB_PACKAGE: module.fail_json(msg=missing_required_lib('github3.py >= 1.0.0a4'), exception=GITHUB_IMP_ERR) organization = module.params['organization'] repo = module.params['repo'] issue = module.params['issue'] action = module.params['action'] result = dict() gh_obj = github3.issue(organization, repo, issue) if gh_obj is None: module.fail_json(msg="Failed to get details about issue specified. " "Please check organization, repo and issue " "details and try again.") if action == 'get_status' or action is None: if module.check_mode: result.update(changed=True) else: result.update(changed=True, issue_status=gh_obj.state) module.exit_json(**result)
def main(): module = AnsibleModule( argument_spec=dict( organization=dict(required=True), repo=dict(required=True), issue=dict(required=True), action=dict(required=False, choices=['get_status']), ), supports_check_mode=True, ) if not HAS_GITHUB_PACKAGE: module.fail_json(msg="Missing required github3 module. (check docs or " "install with: pip install github3.py==1.0.0a4)") organization = module.params['organization'] repo = module.params['repo'] issue = module.params['issue'] action = module.params['action'] result = dict() gh_obj = github3.issue(organization, repo, issue) if gh_obj is None: module.fail_json(msg="Failed to get details about issue specified. " "Please check organization, repo and issue " "details and try again.") if action == 'get_status' or action is None: if module.check_mode: result.update(changed=True) else: result.update(changed=True, issue_status=gh_obj.state) module.exit_json(**result)
import github3 import textwrap i = github3.issue('kennethreitz', 'requests', 868) for line in textwrap.wrap(i.body_text, 78, replace_whitespace=False): print line
def test_issue(self): args = ('owner', 'repo', 1) github3.issue(*args) self.gh.issue.assert_called_with(*args)
def test_issue(self): expect(github3.issue(self.gh3py, self.test_repo, 1))
def test_issue(self): """Show that github3.issue proxies to GitHub.""" github3.issue('sigmavirus24', 'github3.py', 100) self.gh.issue.assert_called_with('sigmavirus24', 'github3.py', 100)