diff options
author | 2012-04-03 19:06:02 +0200 | |
---|---|---|
committer | 2012-04-03 19:06:02 +0200 | |
commit | 30033cb33d828d96492c429407977a9f7912bf28 (patch) | |
tree | 4b2804b3cc2391f19325dbe302b95a0c98a87b65 /pygithub3/tests | |
parent | services.gists.Gist done (diff) | |
download | python-github3-30033cb33d828d96492c429407977a9f7912bf28.tar.xz python-github3-30033cb33d828d96492c429407977a9f7912bf28.zip |
services.gists.Comment done
Diffstat (limited to 'pygithub3/tests')
-rw-r--r-- | pygithub3/tests/services/test_gists.py | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/pygithub3/tests/services/test_gists.py b/pygithub3/tests/services/test_gists.py index 66ff537..8cf93ed 100644 --- a/pygithub3/tests/services/test_gists.py +++ b/pygithub3/tests/services/test_gists.py @@ -6,7 +6,7 @@ from mock import patch, Mock from pygithub3.tests.utils.core import TestCase from pygithub3.resources.base import json -from pygithub3.services.gists import Gist +from pygithub3.services.gists import Gist, Comments from pygithub3.tests.utils.base import (mock_response, mock_response_result, mock_json) from pygithub3.tests.utils.services import _ @@ -91,3 +91,40 @@ class TestGistService(TestCase): self.gs.delete(1) self.assertEqual(request_method.call_args[0], ('delete', _('gists/1'))) + + +@patch.object(requests.sessions.Session, 'request') +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'))) |