|
4 | 4 | from mock import patch |
5 | 5 |
|
6 | 6 | from pygithub3.services.repos import (Repo, Collaborators, Commits, Downloads, |
7 | | - Forks, Keys, Watchers, Hooks) |
| 7 | + Forks, Keys, Watchers, 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 |
@@ -416,3 +416,25 @@ def test_DELETE(self, request_method): |
416 | 416 | self.hs.delete(1) |
417 | 417 | self.assertEqual(request_method.call_args[0], |
418 | 418 | ('delete', _('repos/oct/re_oct/hooks/1'))) |
| 419 | + |
| 420 | +@dummy_json |
| 421 | +@patch.object(requests.sessions.Session, 'request') |
| 422 | +class TestStatusesService(TestCase): |
| 423 | + |
| 424 | + def setUp(self): |
| 425 | + self.ss = Statuses(user='oct', repo='re_oct') |
| 426 | + |
| 427 | + def test_LIST(self, request_method): |
| 428 | + request_method.return_value = mock_response_result() |
| 429 | + self.ss.list(sha='e3bc').all() |
| 430 | + self.assertEqual(request_method.call_args[0], |
| 431 | + ('get', _('repos/oct/re_oct/statuses/e3bc'))) |
| 432 | + |
| 433 | + def test_CREATE(self, request_method): |
| 434 | + request_method.return_value = mock_response('post') |
| 435 | + self.ss.create({"state": "success", |
| 436 | + "target_url": "https://example.com/build/status", |
| 437 | + "description": "The build succeeded!"}, |
| 438 | + sha='e3bc') |
| 439 | + self.assertEqual(request_method.call_args[0], |
| 440 | + ('post', _('repos/oct/re_oct/statuses/e3bc'))) |
0 commit comments