def setUp(self): self.fs = Followers()
class TestFollowersService(TestCase): def setUp(self): self.fs = Followers() def test_LIST_without_user(self, request_method): request_method.return_value = mock_response_result() self.fs.list().all() self.assertEqual(request_method.call_args[0], ('get', _('user/followers'))) def test_LIST_with_user(self, request_method): request_method.return_value = mock_response_result() self.fs.list('octocat').all() self.assertEqual(request_method.call_args[0], ('get', _('users/octocat/followers'))) def test_LIST_FOLLOWING_without_user(self, request_method): request_method.return_value = mock_response_result() self.fs.list_following().all() self.assertEqual(request_method.call_args[0], ('get', _('user/following'))) def test_LIST_FOLLOWING_with_user(self, request_method): request_method.return_value = mock_response_result() self.fs.list_following('octocat').all() self.assertEqual(request_method.call_args[0], ('get', _('users/octocat/following'))) def test_IS_FOLLOWING(self, request_method): self.fs.is_following('octocat') self.assertEqual(request_method.call_args[0], ('head', _('user/following/octocat'))) def test_FOLLOW(self, request_method): #request_method.return_value = mock_response('put') self.fs.follow('octocat') self.assertEqual(request_method.call_args[0], ('put', _('user/following/octocat'))) def test_UNFOLLOW(self, request_method): request_method.return_value = mock_response('delete') self.fs.unfollow('octocat') self.assertEqual(request_method.call_args[0], ('delete', _('user/following/octocat')))