Esempio n. 1
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')))
Esempio n. 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')))
Esempio n. 3
0
 def setUp(self):
     self.cs = Comments()
Esempio n. 4
0
 def setUp(self):
     self.cs = Comments()