# 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/refund.py
# class Refund(PayStackBase):
# 	
# 	@classmethod
# 	def create(cls, **kwargs):
# 		"""
# 		Function defined to create a refund.
# 
# 		Args:
# 		transaction: Transaction reference or id
# 		amount: How much in kobo to be refunded to the customer - Optional
# 		currency: Three-letter ISO currency - Optional
# 		customer_note: Customer reason - Optional
# 		merchant_note: Merchant reason - Optional
# 		
# 		Returns:
# 		Json data from paystack API.
# 		"""
# 		
# 		return cls().requests.post('refund', data=kwargs)
# 	
# 	@classmethod
# 	def list(cls, **kwargs):
# 		"""
# 		List Refunds
# 		
# 		Args:
# 			reference: Identifier for transaction to be refunded - Optional
# 			currency: Three-letter ISO currency - Optional
# 		
# 		Returns:
# 		JSON data from paystack's API.
# 		"""
# 		
# 		return cls().requests.get('refund', data=kwargs)
# 	
# 	@classmethod
# 	def fetch(cls, refund_id):
# 		"""
# 		Fetch a Refund
# 		
# 		Args:
# 			refund_id: Identifier for refund to be fetched
# 		
# 		Return:
# 			JSON data from paystack API
# 		"""
# 		
# 		return cls().requests.get(f"refund/{refund_id}")


import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.refund import Refund
	@httpretty.activate
	def test_list(self):
		"""Test Refund List Method"""
		httpretty.register_uri(
			httpretty.GET,
			self.endpoint_url("refund"),
			content_type='text/json',
			body='{"status": true, "message": "Refunds retrieved", "data": [], "meta": {}}',
			status=200,
		)

		response = Refund.list()
		self.assertTrue(response['status'])
		self.assertIn('message', response)
		self.assertIn('data', response)
		self.assertIn('meta', response)
		self.assertListEqual([], response['data'])
		self.assertDictEqual({}, response['meta'])

	@httpretty.activate
	def test_fetch(self):
		"""Test Refund Fetching"""
		httpretty.register_uri(
			httpretty.GET,
			self.endpoint_url("refund/1234"),
			content_type='text/json',
			body='{"status": true, "message": "Refund retrieved", "data": {"id": 1234}}',
			status=200,
		)


# 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/refund.py
# class Refund(PayStackBase):
# 	
# 	@classmethod
# 	def create(cls, **kwargs):
# 		"""
# 		Function defined to create a refund.
# 
# 		Args:
# 		transaction: Transaction reference or id
# 		amount: How much in kobo to be refunded to the customer - Optional
# 		currency: Three-letter ISO currency - Optional
# 		customer_note: Customer reason - Optional
# 		merchant_note: Merchant reason - Optional
# 		
# 		Returns:
# 		Json data from paystack API.
# 		"""
# 		
# 		return cls().requests.post('refund', data=kwargs)
# 	
# 	@classmethod
# 	def list(cls, **kwargs):
# 		"""
# 		List Refunds
# 		
# 		Args:
# 			reference: Identifier for transaction to be refunded - Optional
# 			currency: Three-letter ISO currency - Optional
# 		
# 		Returns:
# 		JSON data from paystack's API.
# 		"""
# 		
# 		return cls().requests.get('refund', data=kwargs)
# 	
# 	@classmethod
# 	def fetch(cls, refund_id):
# 		"""
# 		Fetch a Refund
# 		
# 		Args:
# 			refund_id: Identifier for refund to be fetched
# 		
# 		Return:
# 			JSON data from paystack API
# 		"""
# 		
# 		return cls().requests.get(f"refund/{refund_id}")


# Path: paystackapi/tests/test_refund.py
import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.refund import Refund

	@httpretty.activate
	def test_list(self):
		"""Test Refund List Method"""
		httpretty.register_uri(
			httpretty.GET,
			self.endpoint_url("refund"),
			content_type='text/json',
			body='{"status": true, "message": "Refunds retrieved", "data": [], "meta": {}}',
			status=200,
		)

		response = Refund.list()
		self.assertTrue(response['status'])
		self.assertIn('message', response)
		self.assertIn('data', response)
		self.assertIn('meta', response)
		self.assertListEqual([], response['data'])
		self.assertDictEqual({}, response['meta'])

	@httpretty.activate
	def test_fetch(self):
		"""Test Refund Fetching"""
		httpretty.register_uri(
			httpretty.GET,
			self.endpoint_url("refund/1234"),
			content_type='text/json',
			body='{"status": true, "message": "Refund retrieved", "data": {"id": 1234}}',
			status=200,
		)


		response = Refund.fetch(refund_id=1234)