forked from routablehq/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_account.py
More file actions
42 lines (33 loc) · 1.39 KB
/
test_account.py
File metadata and controls
42 lines (33 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from datetime import datetime
import os
import unittest
from quickbooks.client import QuickBooks
from quickbooks.objects.account import Account
class AccountTest(unittest.TestCase):
def setUp(self):
QuickBooks(
sandbox=True,
consumer_key=os.environ.get('CONSUMER_KEY'),
consumer_secret=os.environ.get('CONSUMER_SECRET'),
access_token=os.environ.get('ACCESS_TOKEN'),
access_token_secret=os.environ.get('ACCESS_TOKEN_SECRET'),
company_id=os.environ.get('COMPANY_ID')
)
self.account_number = datetime.now().strftime('%d%H%M')
self.name = "Test Account {0}".format(self.account_number)
def test_create(self):
account = Account()
account.AcctNum = self.account_number
account.Name = self.name
account.AccountSubType = "CashOnHand"
account.save()
self.id = account.Id
query_account = Account.get(account.Id)
self.assertEquals(account.Id, query_account.Id)
self.assertEquals(query_account.Name, self.name)
self.assertEquals(query_account.AcctNum, self.account_number)
def test_update(self):
account = Account.filter(Name=self.name)[0]
account.Name = "Updated Name {0}".format(self.account_number)
account.save()
self.assertEquals(account.Name, "Updated Name {0}".format(self.account_number))