|
6 | 6 | import requests |
7 | 7 | from mock import patch, Mock |
8 | 8 |
|
9 | | -from pygithub3.services.repos import Repo, Collaborator, Commits, Downloads |
| 9 | +from pygithub3.services.repos import (Repo, Collaborator, Commits, Downloads, |
| 10 | + Forks) |
10 | 11 | from pygithub3.resources.base import json |
11 | 12 | from pygithub3.tests.utils.base import (mock_response, mock_response_result, |
12 | 13 | mock_json) |
@@ -268,3 +269,22 @@ def test_CREATE(self, request_method): |
268 | 269 | self.assertEqual(request_method.call_args[0], |
269 | 270 | ('post', _('repos/oct/re_oct/downloads'))) |
270 | 271 | self.assertTrue(hasattr(download, 'upload')) |
| 272 | + |
| 273 | + |
| 274 | +@patch.object(requests.sessions.Session, 'request') |
| 275 | +class TestForksService(TestCase): |
| 276 | + |
| 277 | + def setUp(self): |
| 278 | + self.fs = Forks(user='oct', repo='re_oct') |
| 279 | + |
| 280 | + def test_LIST(self, request_method): |
| 281 | + request_method.return_value = mock_response_result() |
| 282 | + self.fs.list().all() |
| 283 | + self.assertEqual(request_method.call_args[0], |
| 284 | + ('get', _('repos/oct/re_oct/forks'))) |
| 285 | + |
| 286 | + def test_CREATE(self, request_method): |
| 287 | + request_method.return_value = mock_response('post') |
| 288 | + self.fs.create() |
| 289 | + self.assertEqual(request_method.call_args[0], |
| 290 | + ('post', _('repos/oct/re_oct/forks'))) |
0 commit comments