|
4 | 4 | from mock import patch |
5 | 5 |
|
6 | 6 | from pygithub3.services.repos import (Repo, Collaborators, Commits, Downloads, |
7 | | - Forks, Keys, Watchers, Stargazers, Hooks) |
| 7 | + Forks, Keys, Watchers, Stargazers, Hooks, Statuses) |
8 | 8 | from pygithub3.tests.utils.base import (dummy_json, mock_response, |
9 | 9 | mock_response_result) |
10 | 10 | from pygithub3.tests.utils.core import TestCase |
@@ -459,3 +459,25 @@ def test_DELETE(self, request_method): |
459 | 459 | self.hs.delete(1) |
460 | 460 | self.assertEqual(request_method.call_args[0], |
461 | 461 | ('delete', _('repos/oct/re_oct/hooks/1'))) |
| 462 | + |
| 463 | +@dummy_json |
| 464 | +@patch.object(requests.sessions.Session, 'request') |
| 465 | +class TestStatusesService(TestCase): |
| 466 | + |
| 467 | + def setUp(self): |
| 468 | + self.ss = Statuses(user='oct', repo='re_oct') |
| 469 | + |
| 470 | + def test_LIST(self, request_method): |
| 471 | + request_method.return_value = mock_response_result() |
| 472 | + self.ss.list(sha='e3bc').all() |
| 473 | + self.assertEqual(request_method.call_args[0], |
| 474 | + ('get', _('repos/oct/re_oct/statuses/e3bc'))) |
| 475 | + |
| 476 | + def test_CREATE(self, request_method): |
| 477 | + request_method.return_value = mock_response('post') |
| 478 | + self.ss.create({"state": "success", |
| 479 | + "target_url": "https://example.com/build/status", |
| 480 | + "description": "The build succeeded!"}, |
| 481 | + sha='e3bc') |
| 482 | + self.assertEqual(request_method.call_args[0], |
| 483 | + ('post', _('repos/oct/re_oct/statuses/e3bc'))) |
0 commit comments