From 96d4523ef45c97055d7b81406b40095ea8be1413 Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Fri, 27 May 2022 23:13:37 +1200 Subject: [PATCH] Add test to cover all lines --- tests/api_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/api_test.py b/tests/api_test.py index 5e40371..a879600 100644 --- a/tests/api_test.py +++ b/tests/api_test.py @@ -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