You've already forked akaunting-py
Added Expense Transaction Test
This commit is contained in:
@@ -55,7 +55,7 @@ class TestAPI:
|
||||
json=RetrieveJSONFromFile("data/GetAccountsList.json"))
|
||||
data = c.get_accounts(params={'page': 1, 'limit': 200})
|
||||
|
||||
def test_create_transaction_success(self, setUp, requests_mock,
|
||||
def test_create_transaction_income_success(self, setUp, requests_mock,
|
||||
type='income', # Payment method type
|
||||
account_id=2, # Account ID to assign
|
||||
category_id=3, # Category ID to assign
|
||||
@@ -84,7 +84,7 @@ class TestAPI:
|
||||
description="Some description of the transaction"
|
||||
)
|
||||
|
||||
def test_create_transaction_failed(self, setUp, requests_mock,
|
||||
def test_create_transaction_income_failed(self, setUp, requests_mock,
|
||||
contact_id=None, # Contact ID/Client to assign
|
||||
reference=None, # Reference for the payment
|
||||
currency_code="NZD", # Currency code
|
||||
@@ -103,4 +103,20 @@ class TestAPI:
|
||||
amount=amount,
|
||||
description="Some description of the transaction"
|
||||
)
|
||||
|
||||
def test_create_transaction_expense_success(self, setUp, requests_mock):
|
||||
c = setUp
|
||||
requests_mock.post(c.url + "/transactions",
|
||||
json=RetrieveJSONFromFile("data/CreateTransactionExpenseSuccess.json"),
|
||||
status_code=201)
|
||||
data = c.create_transaction(type="expense",
|
||||
amount=100.00,
|
||||
account_id=3,
|
||||
paid_at="2022-05-16",
|
||||
currency_rate=1,
|
||||
currency_code="NZD",
|
||||
payment_method="Bank Transfer",
|
||||
category_id="4",
|
||||
description="Some expenditures"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user