From d77b308ab6c66ab42561b18289c679e2eb8c7877 Mon Sep 17 00:00:00 2001 From: Edward Emanuel Date: Mon, 20 May 2024 13:40:25 -0500 Subject: [PATCH] Update readme for from_json --- README.md | 4 ++-- tests/integration/test_account.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b0ae95b..45a2293 100644 --- a/README.md +++ b/README.md @@ -277,10 +277,10 @@ Converting an object to JSON data: Loading JSON data into a quickbooks object: - account = Account() - account.from_json( + account = Account.from_json( { "AccountType": "Accounts Receivable", + "AcctNum": "123123", "Name": "MyJobs" } ) diff --git a/tests/integration/test_account.py b/tests/integration/test_account.py index 4efde66..78d5b46 100644 --- a/tests/integration/test_account.py +++ b/tests/integration/test_account.py @@ -32,3 +32,12 @@ def test_update(self): query_account = Account.get(account.Id, qb=self.qb_client) self.assertEqual(query_account.Name, "Updated Name {0}".format(self.account_number)) + + def test_create_using_from_json(self): + account = Account.from_json({ + "AcctNum": self.account_number, + "Name": self.name, + "AccountSubType": "CashOnHand" + }) + + account.save(qb=self.qb_client)