1 from unittest
import main
3 from datetime
import datetime
5 from gnucash
import Account, \
6 ACCT_TYPE_RECEIVABLE, ACCT_TYPE_INCOME, ACCT_TYPE_BANK, \
8 from gnucash.gnucash_business
import Vendor, Employee, Customer, Job, Invoice, Entry
10 from test_book
import BookSession
14 BookSession.setUp(self)
16 self.
today = datetime.today()
19 self.bank.SetType(ACCT_TYPE_BANK)
20 self.bank.SetCommodity(self.
currency)
22 self.income.SetType(ACCT_TYPE_INCOME)
23 self.income.SetCommodity(self.
currency)
25 self.receivable.SetType(ACCT_TYPE_RECEIVABLE)
26 self.receivable.SetCommodity(self.
currency)
34 self.invoice.SetDateOpened(self.
today)
35 entry = Entry(self.
book)
36 entry.SetDate(self.
today)
37 entry.SetDescription(
"Some income")
38 entry.SetQuantity(GncNumeric(1))
39 entry.SetInvAccount(self.
income)
40 entry.SetInvPrice(GncNumeric(100))
41 self.invoice.AddEntry(entry)
48 self.assertTrue( self.vendor.Equal( self.vendor.GetVendor() ) )
49 self.assertTrue( self.customer.Equal( self.job.GetOwner() ) )
50 self.assertTrue( self.customer.Equal( self.invoice.GetOwner() ) )
52 def test_employee_name(self):
54 self.assertEqual(
'', self.employee.GetUsername() )
55 self.employee.SetUsername(NAME)
56 self.assertEqual( NAME, self.employee.GetUsername() )
59 self.assertTrue( self.invoice.IsPosted() )
62 OWNER = self.invoice.GetOwner()
63 self.assertTrue( self.customer.Equal( OWNER ) )
65 def test_commodities(self):
66 self.assertTrue( self.currency.equal( self.customer.GetCommoditiesList()[0] ) )
68 if __name__ ==
'__main__':
struct account_s Account
Account in Gnucash. This is the typename for an account. The actual structure is defined in the priva...