# Path: goodreads_api_client/resources/review.py
# class Review(Resource):
#     resource_name = 'review'
# 
#     def create(self):
#         raise OauthEndpointNotImplemented('review.create')
# 
#     def destroy(self):
#         raise OauthEndpointNotImplemented('review.destroy')
# 
#     def edit(self):
#         raise OauthEndpointNotImplemented('review.edit')
# 
#     def list(self):
#         raise OauthEndpointNotImplemented('review.list')
# 
#     def recent_reviews(self):
#         endpoint = 'review/recent_reviews'
#         res = self._transport.req(endpoint=endpoint)
#         return res['reviews']
# 
#     def show(self, id_: str):
#         return self._show_single_resource(id_)
# 
#     def show_by_user_and_book(self, user_id: str, book_id: str,
#                               include_review_on_work: bool=False):
#         endpoint = 'review/show_by_user_and_book'
#         params = {
#             'book_id': book_id,
#             'include_review_on_work': include_review_on_work,
#             'user_id': user_id,
#         }
#         res = self._transport.req(endpoint=endpoint, params=params)
#         return res['review']
# 
# Path: goodreads_api_client/tests/resources/conftest.py
# class ResourceTestCase(unittest.TestCase):
#     @classmethod
#     def setUpClass(cls):
#         """Run both child class setup, as well as this class setup.
# 
#         Taken from https://gist.github.com/twolfson/13f5f5784f67fd49b245.
#         """
#         if cls is not ResourceTestCase and \
#                 cls.setUp is not ResourceTestCase.setUp:
#             child_setup = cls.setUp
# 
#             def merged_setup(self, *args, **kwargs):
#                 ResourceTestCase.setUp(self)
#                 return child_setup(self, *args, **kwargs)
# 
#             cls.setUp = merged_setup
# 
#     def setUp(self):
#         self._transport = Transport(developer_key=developer_key,
#                                     developer_secret=developer_secret)
# 
#         patch_transport = patch.object(Transport, 'session', requests)
#         patch_transport.start()
# 
#         self.addCleanup(patch_transport.stop)
# 
#         if self._transport.is_using_session():
#             self.addCleanup(self._transport.session.close)
# 
# Path: goodreads_api_client/tests/conftest.py
# def make_vcr():


from goodreads_api_client.resources import Review
from goodreads_api_client.tests.resources.conftest import ResourceTestCase
from goodreads_api_client.tests.conftest import vcr


class TestReview(ResourceTestCase):
    def setUp(self):
        self._review = Review(transport=self._transport)

    @vcr.use_cassette('review/recent_reviews.yaml')
    def test_recent_reviews(self):
        result = self._review.recent_reviews()

        self.assertTrue(len(result) > 0)

    @vcr.use_cassette('review/show.yaml')
    def test_show(self):
        result = self._review.show('21')

        self.assertEqual(result['id'], '21')
        self.assertEqual(str(result['rating']), '5')


# Path: goodreads_api_client/resources/review.py
# class Review(Resource):
#     resource_name = 'review'
# 
#     def create(self):
#         raise OauthEndpointNotImplemented('review.create')
# 
#     def destroy(self):
#         raise OauthEndpointNotImplemented('review.destroy')
# 
#     def edit(self):
#         raise OauthEndpointNotImplemented('review.edit')
# 
#     def list(self):
#         raise OauthEndpointNotImplemented('review.list')
# 
#     def recent_reviews(self):
#         endpoint = 'review/recent_reviews'
#         res = self._transport.req(endpoint=endpoint)
#         return res['reviews']
# 
#     def show(self, id_: str):
#         return self._show_single_resource(id_)
# 
#     def show_by_user_and_book(self, user_id: str, book_id: str,
#                               include_review_on_work: bool=False):
#         endpoint = 'review/show_by_user_and_book'
#         params = {
#             'book_id': book_id,
#             'include_review_on_work': include_review_on_work,
#             'user_id': user_id,
#         }
#         res = self._transport.req(endpoint=endpoint, params=params)
#         return res['review']
# 
# Path: goodreads_api_client/tests/resources/conftest.py
# class ResourceTestCase(unittest.TestCase):
#     @classmethod
#     def setUpClass(cls):
#         """Run both child class setup, as well as this class setup.
# 
#         Taken from https://gist.github.com/twolfson/13f5f5784f67fd49b245.
#         """
#         if cls is not ResourceTestCase and \
#                 cls.setUp is not ResourceTestCase.setUp:
#             child_setup = cls.setUp
# 
#             def merged_setup(self, *args, **kwargs):
#                 ResourceTestCase.setUp(self)
#                 return child_setup(self, *args, **kwargs)
# 
#             cls.setUp = merged_setup
# 
#     def setUp(self):
#         self._transport = Transport(developer_key=developer_key,
#                                     developer_secret=developer_secret)
# 
#         patch_transport = patch.object(Transport, 'session', requests)
#         patch_transport.start()
# 
#         self.addCleanup(patch_transport.stop)
# 
#         if self._transport.is_using_session():
#             self.addCleanup(self._transport.session.close)
# 
# Path: goodreads_api_client/tests/conftest.py
# def make_vcr():


# Path: goodreads_api_client/tests/resources/test_review.py
from goodreads_api_client.resources import Review
from goodreads_api_client.tests.resources.conftest import ResourceTestCase
from goodreads_api_client.tests.conftest import vcr



class TestReview(ResourceTestCase):
    def setUp(self):
        self._review = Review(transport=self._transport)

    @vcr.use_cassette('review/recent_reviews.yaml')
    def test_recent_reviews(self):
        result = self._review.recent_reviews()

        self.assertTrue(len(result) > 0)

    @vcr.use_cassette('review/show.yaml')
    def test_show(self):
        result = self._review.show('21')

        self.assertEqual(result['id'], '21')
        self.assertEqual(str(result['rating']), '5')


    @vcr.use_cassette('review/show_by_user_and_book.yaml')