# Path: paystackapi/tests/base_test_case.py
# class BaseTestCase(unittest.TestCase):
# 		
# 	def endpoint_url(self, path):
# 		if path[0] == '/':
# 			return 'https://api.paystack.co{}'.format(path)
# 		return 'https://api.paystack.co/{}'.format(path)
# 
# Path: paystackapi/base.py
# class PayStackBase(Borg):
# 	"""Base Class used across defined."""
# 
# 	def __init__(self, **kwargs):
# 		"""Initialize Paystack with secret key."""
# 		Borg.__init__(self)
# 		secret_key = kwargs.get('secret_key', api.SECRET_KEY)
# 		authorization = kwargs.get(
# 			'authorization',
# 			f"{api.HEADERS['Authorization'].format(secret_key)}")
# 		headers = dict(Authorization=authorization)
# 		arguments = dict(api_url=api.API_URL, headers=headers)
# 		if not hasattr(self, 'requests'):
# 			req = PayStackRequests(**arguments)
# 			self._shared_state.update(requests=req)
# 
# class PayStackRequests(object):
# 
# 	def __init__(self, api_url='https://api.paystack.co/',
# 				 headers=None):
# 		"""Initialize Paystack Request object for browsing resource.
# 
# 		Args:
# 			api_url: str
# 			headers: dict
# 		"""
# 		self.API_BASE_URL = f"{api_url}"
# 		self.headers = headers
# 
# 	def _request(self, method, resource_uri, **kwargs):
# 		"""Perform a method on a resource.
# 
# 		Args:
# 			method: requests.`method`
# 			resource_uri: resource endpoint
# 		Raises:
# 			HTTPError
# 		Returns:
# 			JSON Response
# 		"""
# 		data = kwargs.get('data')
# 		qs = kwargs.get('qs')
# 
# 		response = method(
# 			self.API_BASE_URL + resource_uri,
# 			json=data, headers=self.headers,
# 			params=qs
# 		)
# 		return response.json()
# 
# 	def get(self, endpoint, **kwargs):
# 		"""Get a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.get, endpoint, **kwargs)
# 
# 	def post(self, endpoint, **kwargs):
# 		"""Create a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.post, endpoint, **kwargs)
# 
# 	def put(self, endpoint, **kwargs):
# 		"""Update a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.put, endpoint, **kwargs)


import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.base import PayStackBase, PayStackRequests
        response = req.get('transaction/4013',)
        self.assertTrue(response['status'])

    @httpretty.activate
    def test_post_method_called(self):

        httpretty.register_uri(
            httpretty.POST,
            self.endpoint_url("/transaction/charge_token"),
            content_type='text/json',
            body='{"status": true, "contributors": null}',
            status=302,
        )

        req = PayStackRequests()
        response = req.post('transaction/charge_token',
                            data={'track': 'requests'})
        self.assertTrue(response['status'])

    @httpretty.activate
    def test_put_method_called(self):

        httpretty.register_uri(
            httpretty.PUT,
            self.endpoint_url("/customer/4013"),
            content_type='text/json',
            body='{"status": true, "contributors": null}',
            status=302,
        )


# Path: paystackapi/tests/base_test_case.py
# class BaseTestCase(unittest.TestCase):
# 		
# 	def endpoint_url(self, path):
# 		if path[0] == '/':
# 			return 'https://api.paystack.co{}'.format(path)
# 		return 'https://api.paystack.co/{}'.format(path)
# 
# Path: paystackapi/base.py
# class PayStackBase(Borg):
# 	"""Base Class used across defined."""
# 
# 	def __init__(self, **kwargs):
# 		"""Initialize Paystack with secret key."""
# 		Borg.__init__(self)
# 		secret_key = kwargs.get('secret_key', api.SECRET_KEY)
# 		authorization = kwargs.get(
# 			'authorization',
# 			f"{api.HEADERS['Authorization'].format(secret_key)}")
# 		headers = dict(Authorization=authorization)
# 		arguments = dict(api_url=api.API_URL, headers=headers)
# 		if not hasattr(self, 'requests'):
# 			req = PayStackRequests(**arguments)
# 			self._shared_state.update(requests=req)
# 
# class PayStackRequests(object):
# 
# 	def __init__(self, api_url='https://api.paystack.co/',
# 				 headers=None):
# 		"""Initialize Paystack Request object for browsing resource.
# 
# 		Args:
# 			api_url: str
# 			headers: dict
# 		"""
# 		self.API_BASE_URL = f"{api_url}"
# 		self.headers = headers
# 
# 	def _request(self, method, resource_uri, **kwargs):
# 		"""Perform a method on a resource.
# 
# 		Args:
# 			method: requests.`method`
# 			resource_uri: resource endpoint
# 		Raises:
# 			HTTPError
# 		Returns:
# 			JSON Response
# 		"""
# 		data = kwargs.get('data')
# 		qs = kwargs.get('qs')
# 
# 		response = method(
# 			self.API_BASE_URL + resource_uri,
# 			json=data, headers=self.headers,
# 			params=qs
# 		)
# 		return response.json()
# 
# 	def get(self, endpoint, **kwargs):
# 		"""Get a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.get, endpoint, **kwargs)
# 
# 	def post(self, endpoint, **kwargs):
# 		"""Create a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.post, endpoint, **kwargs)
# 
# 	def put(self, endpoint, **kwargs):
# 		"""Update a resource.
# 
# 		Args:
# 			endpoint: resource endpoint.
# 		"""
# 		return self._request(requests.put, endpoint, **kwargs)


# Path: paystackapi/tests/test_base.py
import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.base import PayStackBase, PayStackRequests

        response = req.get('transaction/4013',)
        self.assertTrue(response['status'])

    @httpretty.activate
    def test_post_method_called(self):

        httpretty.register_uri(
            httpretty.POST,
            self.endpoint_url("/transaction/charge_token"),
            content_type='text/json',
            body='{"status": true, "contributors": null}',
            status=302,
        )

        req = PayStackRequests()
        response = req.post('transaction/charge_token',
                            data={'track': 'requests'})
        self.assertTrue(response['status'])

    @httpretty.activate
    def test_put_method_called(self):

        httpretty.register_uri(
            httpretty.PUT,
            self.endpoint_url("/customer/4013"),
            content_type='text/json',
            body='{"status": true, "contributors": null}',
            status=302,
        )


        req = PayStackRequests()