You've already forked akaunting-py
Add test to cover all lines
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
|
||||
sys.path.insert(1, '.')
|
||||
from helpers import RetrieveJSONFromFile
|
||||
import akauntingpy
|
||||
@@ -96,6 +97,32 @@ class TestAPI:
|
||||
description="Some description of the transaction"
|
||||
)
|
||||
|
||||
def test_create_transaction_income_default_currency_success(self, setUp, requests_mock,
|
||||
transaction_type='income', # Payment method type
|
||||
account_id=2, # Account ID to assign
|
||||
category_id=3, # Category ID to assign
|
||||
contact_id=None, # Contact ID/Client to assign
|
||||
paid_at="2022-05-15",
|
||||
# Date of expense/transfer or income
|
||||
reference=None, # Reference for the payment
|
||||
payment_method="bank_transfer", # Payment method
|
||||
amount="25.00", # Amount received/paid
|
||||
):
|
||||
c = setUp
|
||||
requests_mock.post(c.url + "/transactions",
|
||||
json=RetrieveJSONFromFile("data/CreateTransactionIncomeSuccess.json"),
|
||||
status_code=201)
|
||||
data = c.create_transaction(transaction_type=transaction_type,
|
||||
account_id=account_id,
|
||||
category_id=category_id,
|
||||
paid_at=paid_at,
|
||||
contact_id=contact_id,
|
||||
payment_method=payment_method,
|
||||
reference=reference,
|
||||
amount=amount,
|
||||
description="Some description of the transaction"
|
||||
)
|
||||
|
||||
def test_create_transaction_income_failed(self, setUp, requests_mock,
|
||||
contact_id=None, # Contact ID/Client to assign
|
||||
reference=None, # Reference for the payment
|
||||
|
||||
Reference in New Issue
Block a user