GnuCash c935c2f+
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
test_business.TestBusiness Class Reference
Inheritance diagram for test_business.TestBusiness:
test_business.BusinessSession test_book.BookSession

Public Member Functions

 test_equal (self)
 
 test_employee_name (self)
 
 test_post (self)
 
 test_owner (self)
 
 test_commodities (self)
 
 test_invoice_transaction (self)
 
 test_invoice_payment (self)
 
- Public Member Functions inherited from test_business.BusinessSession
 setUp (self)
 

Data Fields

 receivable
 
 bank
 
- Data Fields inherited from test_business.BusinessSession
 today
 
 bank
 
 currency
 
 income
 
 receivable
 
 customer
 
 vendor
 
 employee
 
 job
 
 invoice
 
- Data Fields inherited from test_book.BookSession
 ses
 
 book
 
 table
 
 currency
 

Detailed Description

Definition at line 46 of file test_business.py.

Member Function Documentation

◆ test_commodities()

test_business.TestBusiness.test_commodities (   self)

Definition at line 74 of file test_business.py.

74 def test_commodities(self):
75 self.assertTrue( self.currency.equal( self.customer.GetCommoditiesList()[0] ) )
76

◆ test_employee_name()

test_business.TestBusiness.test_employee_name (   self)

Definition at line 52 of file test_business.py.

52 def test_employee_name(self):
53 NAME = 'John Doe'
54 self.assertEqual( '', self.employee.GetUsername() )
55 self.employee.SetUsername(NAME)
56 self.assertEqual( NAME, self.employee.GetUsername() )
57

◆ test_equal()

test_business.TestBusiness.test_equal (   self)

Definition at line 47 of file test_business.py.

47 def test_equal(self):
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() ) )
51

◆ test_invoice_payment()

test_business.TestBusiness.test_invoice_payment (   self)
Test that you can pay an invoice into a transfer account (this also tests conversion of Python lists to GList).

Definition at line 86 of file test_business.py.

86 def test_invoice_payment(self):
87 """
88 Test that you can pay an invoice into a transfer account (this also tests conversion of Python lists to GList).
89 """
90 self.receivable.RecomputeBalance()
91 self.assertTrue( int(self.receivable.GetBalance().to_double()) == 100 )
92 lots = [self.invoice.GetPostedLot()]
93 self.customer.ApplyPayment(None, lots, self.receivable, self.bank, GncNumeric(100), GncNumeric(1), self.invoice.GetDatePosted(), "Paid into bank account.", "1234", False)
94 self.receivable.RecomputeBalance()
95 self.assertTrue( self.receivable.GetBalance().to_fraction().numerator == 0 )
96
The primary numeric class for representing amounts and values.

◆ test_invoice_transaction()

test_business.TestBusiness.test_invoice_transaction (   self)
Test that you can get the posted transaction from a posted invoice and that you can get the invoice back from the transaction.

Definition at line 77 of file test_business.py.

77 def test_invoice_transaction(self):
78 """
79 Test that you can get the posted transaction from a posted invoice and that you can get the invoice back from the transaction.
80 """
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() )
85

◆ test_owner()

test_business.TestBusiness.test_owner (   self)

Definition at line 70 of file test_business.py.

70 def test_owner(self):
71 OWNER = self.invoice.GetOwner()
72 self.assertTrue( self.customer.Equal( OWNER ) )
73

◆ test_post()

test_business.TestBusiness.test_post (   self)

Definition at line 58 of file test_business.py.

58 def test_post(self):
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() )
69

Field Documentation

◆ bank

test_business.TestBusiness.bank

Definition at line 93 of file test_business.py.

◆ receivable

test_business.TestBusiness.receivable

Definition at line 93 of file test_business.py.


The documentation for this class was generated from the following file: