예제 #1
0
파일: test_gists.py 프로젝트: tirimula/ITSP
class TestCommentService(TestCase):
    def setUp(self):
        self.cs = Comments()

    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', _('gists/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', _('gists/comments/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.cs.create(1, dict(body='comment'))
        self.assertEqual(request_method.call_args[0],
                         ('post', _('gists/1/comments')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.cs.update(1, dict(body='new_comment'))
        self.assertEqual(request_method.call_args[0],
                         ('patch', _('gists/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', _('gists/comments/1')))
예제 #2
0
class TestCommentService(TestCase):

    def setUp(self):
        self.cs = Comments()

    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', _('gists/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', _('gists/comments/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.cs.create(1, dict(body='comment'))
        self.assertEqual(request_method.call_args[0],
            ('post', _('gists/1/comments')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.cs.update(1, dict(body='new_comment'))
        self.assertEqual(request_method.call_args[0],
            ('patch', _('gists/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', _('gists/comments/1')))
예제 #3
0
파일: test_gists.py 프로젝트: tirimula/ITSP
 def setUp(self):
     self.cs = Comments()
예제 #4
0
 def setUp(self):
     self.cs = Comments()