# Path: goodreads_api_client/resources/series.py
# class Series(Resource):
#     resource_name = 'series'
# 
#     def list(self, author_id: str):
#         endpoint = 'series/list'
#         params = {
#             'id': author_id,
#         }
#         res = self._transport.req(endpoint=endpoint, params=params)
#         return res['series_works']['series_work']
# 
#     def show(self, id_: str):
#         return self._show_single_resource(id_)
# 
#     def work(self, work_id: str):
#         endpoint = 'series/work/{}'.format(work_id)
#         res = self._transport.req(endpoint=endpoint)
#         return res['series_works']['series_work']
# 
# 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 Series
from goodreads_api_client.tests.resources.conftest import ResourceTestCase
from goodreads_api_client.tests.conftest import vcr


class TestSeries(ResourceTestCase):
    def setUp(self):
        self._series = Series(transport=self._transport)

    @vcr.use_cassette('series/list.yaml')
    def test_list(self):
        result = self._series.list('38550')

        self.assertEqual(len(result), 119)
        self.assertEqual(result[0]['id'], '982770')
        self.assertEqual(result[0]['series']['title'],
                         'The Stormlight Archive (GraphicAudio)')


# Path: goodreads_api_client/resources/series.py
# class Series(Resource):
#     resource_name = 'series'
# 
#     def list(self, author_id: str):
#         endpoint = 'series/list'
#         params = {
#             'id': author_id,
#         }
#         res = self._transport.req(endpoint=endpoint, params=params)
#         return res['series_works']['series_work']
# 
#     def show(self, id_: str):
#         return self._show_single_resource(id_)
# 
#     def work(self, work_id: str):
#         endpoint = 'series/work/{}'.format(work_id)
#         res = self._transport.req(endpoint=endpoint)
#         return res['series_works']['series_work']
# 
# 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_series.py
from goodreads_api_client.resources import Series
from goodreads_api_client.tests.resources.conftest import ResourceTestCase
from goodreads_api_client.tests.conftest import vcr



class TestSeries(ResourceTestCase):
    def setUp(self):
        self._series = Series(transport=self._transport)

    @vcr.use_cassette('series/list.yaml')
    def test_list(self):
        result = self._series.list('38550')

        self.assertEqual(len(result), 119)
        self.assertEqual(result[0]['id'], '982770')
        self.assertEqual(result[0]['series']['title'],
                         'The Stormlight Archive (GraphicAudio)')


    @vcr.use_cassette('series/show.yaml')