# Path: rakuten_ws/webservice.py
# class RakutenWebService(BaseWebService):
# 
#     rms = RmsService()
# 
#     ichiba = IchibaAPI()
#     books = BooksAPI()
#     travel = TravelAPI()
#     auction = AuctionAPI()
#     kobo = KoboAPI()
#     gora = GoraAPI()
#     recipe = RecipeAPI()
#     other = OtherAPI()
# 
# Path: rakuten_ws/baseapi.py
# class ApiResponse(UserDict):
#     def __init__(self, session, url):
#         self.session = session
#         self.url = url
#         self.response = self.session.get(self.url).json()
#         self.data = self.response
# 
#     @property
#     def json(self):
#         return PrettyStringRepr(json.dumps(self.data, ensure_ascii=False, sort_keys=True,
#                                            indent=4, separators=(',', ': ')))
# 
#     def pages(self):
#         yield self.response
#         page_number = int(self.response['page']) + 1
#         while page_number <= self.response['pageCount']:
#             api_request = furl(self.url)
#             api_request.args['page'] = page_number
#             page_number += 1
#             yield self.session.get(api_request.url).json()


import pytest
import types
from rakuten_ws.webservice import RakutenWebService
from rakuten_ws.baseapi import ApiResponse
# -*- coding: utf-8 -*-
from __future__ import unicode_literals


@pytest.mark.online
def test_response(credentials):
    ws = RakutenWebService(**credentials)
    response = ws.ichiba.item.search(keyword="Naruto")
    assert isinstance(response, ApiResponse)


@pytest.mark.online
def test_single_item(credentials):

# Path: rakuten_ws/webservice.py
# class RakutenWebService(BaseWebService):
# 
#     rms = RmsService()
# 
#     ichiba = IchibaAPI()
#     books = BooksAPI()
#     travel = TravelAPI()
#     auction = AuctionAPI()
#     kobo = KoboAPI()
#     gora = GoraAPI()
#     recipe = RecipeAPI()
#     other = OtherAPI()
# 
# Path: rakuten_ws/baseapi.py
# class ApiResponse(UserDict):
#     def __init__(self, session, url):
#         self.session = session
#         self.url = url
#         self.response = self.session.get(self.url).json()
#         self.data = self.response
# 
#     @property
#     def json(self):
#         return PrettyStringRepr(json.dumps(self.data, ensure_ascii=False, sort_keys=True,
#                                            indent=4, separators=(',', ': ')))
# 
#     def pages(self):
#         yield self.response
#         page_number = int(self.response['page']) + 1
#         while page_number <= self.response['pageCount']:
#             api_request = furl(self.url)
#             api_request.args['page'] = page_number
#             page_number += 1
#             yield self.session.get(api_request.url).json()


# Path: tests/test_helpers.py
import pytest
import types
from rakuten_ws.webservice import RakutenWebService
from rakuten_ws.baseapi import ApiResponse

# -*- coding: utf-8 -*-
from __future__ import unicode_literals


@pytest.mark.online
def test_response(credentials):
    ws = RakutenWebService(**credentials)
    response = ws.ichiba.item.search(keyword="Naruto")
    assert isinstance(response, ApiResponse)


@pytest.mark.online
def test_single_item(credentials):

    ws = RakutenWebService(**credentials)