Esempio n. 1
0
class TestInvoice(TestCase):
	def setUp(self):
		self.api = Customer(secret_key=SECRET_KEY, public_key=PUBLIC_KEY)
		self.api.create_customer(email='*****@*****.**')
		self.customer_code = self.api.customer_code

	def test_create_invoice(self):
		api = Invoice(secret_key=SECRET_KEY, public_key=PUBLIC_KEY)
		api.create_invoice(customer=self.customer_code, amount=500000, due_date='2020-12-20')

		self.assertEqual(self.api.ctx.status, True)

	def test_list_invoices(self):
		api = Invoice(secret_key=SECRET_KEY, public_key=PUBLIC_KEY)
		api.list_invoices()

		self.assertEqual(api.ctx.status, True)
Esempio n. 2
0
class TestCustomer(TestCase):
	def setUp(self):
		self.api = Customer(secret_key=SECRET_KEY, public_key=PUBLIC_KEY)
		self.api.create_customer(email='*****@*****.**')
		self.customer_id = self.api.customer_id
		self.customer_code = self.api.customer_code

	def test_create_customer(self):
		self.assertEqual(self.api.ctx.status, True)

	def test_fetch_customer(self):
		self.api.fetch_customer(email_or_id_or_customer_code='*****@*****.**')
		self.assertEqual(self.customer_code, self.api.customer_code)
		self.assertEqual(self.customer_id, self.api.customer_id)
		self.assertEqual(True, self.api.ctx.status)

		self.api.fetch_customer(email_or_id_or_customer_code='*****@*****.**')
		self.assertEqual(False, self.api.ctx.status)
		self.assertEqual(self.api.customer_id, '')
		self.assertEqual(self.api.customer_code, '')