def setUp(self): self.ws = Watchers(user='******', repo='re_oct')
class TestWatchersService(TestCase): def setUp(self): self.ws = Watchers(user='******', repo='re_oct') def test_LIST(self, request_method): request_method.return_value = mock_response_result() self.ws.list().all() self.assertEqual(request_method.call_args[0], ('get', _('repos/oct/re_oct/watchers'))) def test_LIST_repos(self, request_method): request_method.return_value = mock_response_result() self.ws.list_repos().all() self.assertEqual(request_method.call_args[0], ('get', _('user/watched'))) def test_LIST_repos_with_user(self, request_method): request_method.return_value = mock_response_result() self.ws.list_repos('oct').all() self.assertEqual(request_method.call_args[0], ('get', _('users/oct/watched'))) def test_IS_watching(self, request_method): request_method.return_value = mock_response() self.assertTrue(self.ws.is_watching()) self.assertEqual(request_method.call_args[0], ('head', _('user/watched/oct/re_oct'))) def test_WATCH(self, request_method): self.ws.watch() self.assertEqual(request_method.call_args[0], ('put', _('user/watched/oct/re_oct'))) def test_UNWATCH(self, request_method): request_method.return_value = mock_response('delete') self.ws.unwatch() self.assertEqual(request_method.call_args[0], ('delete', _('user/watched/oct/re_oct')))