예제 #1
0
 def __init__(self, methodName='runTest'):
     super(TestIssueLsCommand, self).__init__(methodName)
     self.issue = github3.issues.Issue(self.json('issue'))
     self.command = IssueLsCommand()
     self.command.repository = ('sigmavirus24', 'github3.py')
     self.opts, _ = self.command.parser.parse_args([])
     self.command.repo = github3.repos.Repository(self.json('issue'))
예제 #2
0
class TestIssueLsCommand(BaseTest):
    def __init__(self, methodName='runTest'):
        super(TestIssueLsCommand, self).__init__(methodName)
        self.issue = github3.issues.Issue(self.json('issue'))
        self.command = IssueLsCommand()
        self.command.repository = ('sigmavirus24', 'github3.py')
        self.opts, _ = self.command.parser.parse_args([])
        self.command.repo = github3.repos.Repository(self.json('issue'))

    def test_format_short_issue(self):
        out = self.command.format_short_issue(self.issue)
        assert tc['default'] in out
        assert tc['bold'] in out
        assert 'sigmavirus24' in out
        assert '30' in out

    def test_run(self):
        opts, args = main_parser.parse_args(['issue.ls', '-n', '5'])
        SUCCESS = self.command.SUCCESS
        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