Пример #1
0
class TestIssuesService(TestCase):
    def setUp(self):
        self.isu = Issue(user='******', repo='Hello-World')

    def test_LIST_without_user(self, request_method):
        request_method.return_value = mock_response_result()
        self.isu.list().all()
        self.assertEqual(request_method.call_args[0], ('get', _('issues')))

    def test_LIST_by_repo(self, request_method):
        request_method.return_value = mock_response_result()
        self.isu.list_by_repo().all()
        self.assertEqual(request_method.call_args[0],
                         ('get', _('repos/octocat/Hello-World/issues')))

    def test_GET(self, request_method):
        request_method.return_value = mock_response()
        self.isu.get(1)
        self.assertEqual(request_method.call_args[0],
                         ('get', _('repos/octocat/Hello-World/issues/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.isu.create(dict(title='My issue', body='Fix this issue'))
        self.assertEqual(request_method.call_args[0],
                         ('post', _('repos/octocat/Hello-World/issues')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.isu.update(1, {'body': 'edited'})
        self.assertEqual(request_method.call_args[0],
                         ('patch', _('repos/octocat/Hello-World/issues/1')))
Пример #2
0
class TestIssuesService(TestCase):

    def setUp(self):
        self.isu = Issue(user='******', repo='Hello-World')

    def test_LIST_without_user(self, request_method):
        request_method.return_value = mock_response_result()
        self.isu.list().all()
        self.assertEqual(request_method.call_args[0], ('get', _('issues')))

    def test_LIST_by_repo(self, request_method):
        request_method.return_value = mock_response_result()
        self.isu.list_by_repo().all()
        self.assertEqual(request_method.call_args[0],
            ('get', _('repos/octocat/Hello-World/issues')))

    def test_GET(self, request_method):
        request_method.return_value = mock_response()
        self.isu.get(1)
        self.assertEqual(request_method.call_args[0],
            ('get', _('repos/octocat/Hello-World/issues/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.isu.create(dict(title='My issue', body='Fix this issue'))
        self.assertEqual(request_method.call_args[0],
            ('post', _('repos/octocat/Hello-World/issues')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.isu.update(1, {'body': 'edited'})
        self.assertEqual(request_method.call_args[0],
            ('patch', _('repos/octocat/Hello-World/issues/1')))
Пример #3
0
 def __init__(self, **config):
     from pygithub3.services.users import User
     from pygithub3.services.repos import Repo
     from pygithub3.services.gists import Gist
     from pygithub3.services.git_data import GitData
     from pygithub3.services.pull_requests import PullRequests
     from pygithub3.services.orgs import Org
     from pygithub3.services.issues import Issue
     self._users = User(**config)
     self._repos = Repo(**config)
     self._gists = Gist(**config)
     self._git_data = GitData(**config)
     self._pull_requests = PullRequests(**config)
     self._orgs = Org(**config)
     self._issues = Issue(**config)
Пример #4
0
 def setUp(self):
     self.isu = Issue(user='******', repo='Hello-World')
Пример #5
0
 def setUp(self):
     self.isu = Issue(user='******', repo='Hello-World')