Exemplo n.º 1
0
 def __init__(self, methodName='runTest'):
     super(TestIssueCommand, self).__init__(methodName)
     self.issue = github3.issues.Issue(self.json('issue'))
     self.command = IssueCommand()
     self.command.repository = ('sigmavirus24', 'github3.py')
     self.opts, _ = self.command.parser.parse_args([])
     self.command.repo = github3.repos.Repository(self.json('issue'))
Exemplo n.º 2
0
class TestIssueCommand(BaseTest):
    def __init__(self, methodName='runTest'):
        super(TestIssueCommand, self).__init__(methodName)
        self.issue = github3.issues.Issue(self.json('issue'))
        self.command = IssueCommand()
        self.command.repository = ('sigmavirus24', 'github3.py')
        self.opts, _ = self.command.parser.parse_args([])
        self.command.repo = github3.repos.Repository(self.json('issue'))

    def test_run(self):
        opts, args = main_parser.parse_args(['issue', '30', 'comments'])
        SUCCESS = self.command.SUCCESS
        FAILURE = self.command.FAILURE
        with patch.object(IssueCommand, 'get_repo'):
            with patch.object(self.command.repo, 'issue') as issue:
                issue.return_value = self.issue
                assert self.command.run(opts, args[1:]) == SUCCESS
                assert self.command.run(opts, ['foo']) == FAILURE