def setUp(self): self.sg = Stargazers(user='******', repo='re_oct')
class TestStargazersService(TestCase): def setUp(self): self.sg = Stargazers(user='******', repo='re_oct') def test_LIST(self, request_method): request_method.return_value = mock_response_result() self.sg.list().all() self.assertEqual(request_method.call_args[0], ('get', _('repos/oct/re_oct/stargazers'))) def test_LIST_repos(self, request_method): request_method.return_value = mock_response_result() self.sg.list_repos().all() self.assertEqual(request_method.call_args[0], ('get', _('user/starred'))) def test_LIST_repos_with_user(self, request_method): request_method.return_value = mock_response_result() self.sg.list_repos('oct').all() self.assertEqual(request_method.call_args[0], ('get', _('users/oct/starred'))) def test_IS_starring(self, request_method): request_method.return_value = mock_response() self.assertTrue(self.sg.is_starring()) self.assertEqual(request_method.call_args[0], ('head', _('user/starred/oct/re_oct'))) def test_STAR(self, request_method): self.sg.watch() self.assertEqual(request_method.call_args[0], ('put', _('user/starred/oct/re_oct'))) def test_STAR(self, request_method): request_method.return_value = mock_response('delete') self.sg.unstar() self.assertEqual(request_method.call_args[0], ('delete', _('user/starred/oct/re_oct')))