6 ACCT_TYPE_RECEIVABLE, ACCT_TYPE_INCOME, ACCT_TYPE_BANK, \
8from gnucash.gnucash_business
import Vendor, Employee, Customer, Job, Invoice, Entry
48 self.assertTrue( self.
vendor.Equal( self.
vendor.GetVendor() ) )
49 self.assertTrue( self.
customer.Equal( self.
job.GetOwner() ) )
52 def test_employee_name(self):
54 self.assertEqual(
'', self.
employee.GetUsername() )
56 self.assertEqual( NAME, self.
employee.GetUsername() )
59 utc_offset = datetime.now().astimezone().utcoffset()
60 now = datetime.now().astimezone()
61 neutral_time = (now + utc_offset).astimezone(timezone.utc).replace(hour=10, minute=59, second=0, microsecond=0)
62 if utc_offset > timedelta(hours=13):
63 neutral_time -= utc_offset - timedelta(hours=13);
64 if utc_offset < timedelta(hours=-10):
65 neutral_time += timedelta(hours=-10) - utc_offset
66 self.assertEqual(neutral_time,
67 self.
invoice.GetDatePosted().astimezone(timezone.utc))
68 self.assertTrue( self.
invoice.IsPosted() )
72 self.assertTrue( self.
customer.Equal( OWNER ) )
74 def test_commodities(self):
79 Test that you can get the posted transaction from a posted invoice and that you can get the invoice back from the transaction.
81 posted_transaction = self.
invoice.GetPostedTxn()
82 self.assertTrue( posted_transaction !=
None )
83 invoice_from_transaction = posted_transaction.GetInvoiceFromTxn()
84 self.assertTrue( invoice_from_transaction !=
None and invoice_from_transaction.GetID() == self.
invoice.GetID() )
88 Test that you can pay an invoice into a transfer account (this also tests conversion of Python lists to GList).
92 lots = [self.
invoice.GetPostedLot()]