예제 #1
0
class TestCommentService(TestCase):

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

    def test_LIST(self, request_method):
        request_method.return_value = mock_response_result()
        self.cs.list(1).all()
        self.assertEqual(request_method.call_args[0],
            ('get', _('repos/octocat/Hello-World/issues/1/comments')))

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

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.cs.create(1, 'comment')
        self.assertEqual(request_method.call_args[0],
            ('post', _('repos/octocat/Hello-World/issues/1/comments')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.cs.update(1, 'new comment')
        self.assertEqual(request_method.call_args[0],
            ('patch', _('repos/octocat/Hello-World/issues/comments/1')))

    def test_DELETE(self, request_method):
        request_method.return_value = mock_response('delete')
        self.cs.delete(1)
        self.assertEqual(request_method.call_args[0],
            ('delete', _('repos/octocat/Hello-World/issues/comments/1')))
예제 #2
0
class TestCommentService(TestCase):
    def setUp(self):
        self.cs = Comments(user='******', repo='Hello-World')

    def test_LIST(self, request_method):
        request_method.return_value = mock_response_result()
        self.cs.list(1).all()
        self.assertEqual(
            request_method.call_args[0],
            ('get', _('repos/octocat/Hello-World/issues/1/comments')))

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

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.cs.create(1, 'comment')
        self.assertEqual(
            request_method.call_args[0],
            ('post', _('repos/octocat/Hello-World/issues/1/comments')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.cs.update(1, 'new comment')
        self.assertEqual(
            request_method.call_args[0],
            ('patch', _('repos/octocat/Hello-World/issues/comments/1')))

    def test_DELETE(self, request_method):
        request_method.return_value = mock_response('delete')
        self.cs.delete(1)
        self.assertEqual(
            request_method.call_args[0],
            ('delete', _('repos/octocat/Hello-World/issues/comments/1')))
예제 #3
0
 def setUp(self):
     self.cs = Comments(user='******', repo='Hello-World')
예제 #4
0
 def setUp(self):
     self.cs = Comments(user='******', repo='Hello-World')