示例#1
0
    def setUp(self):
        BookSession.setUp(self)

        self.today = datetime.today()

        self.bank = Account(self.book)
        self.bank.SetType(ACCT_TYPE_BANK)
        self.bank.SetCommodity(self.currency)
        self.income = Account(self.book)
        self.income.SetType(ACCT_TYPE_INCOME)
        self.income.SetCommodity(self.currency)
        self.receivable = Account(self.book)
        self.receivable.SetType(ACCT_TYPE_RECEIVABLE)
        self.receivable.SetCommodity(self.currency)

        self.customer = Customer(self.book,'CustomerID',self.currency)
        self.vendor = Vendor(self.book,'VendorID',self.currency)
        self.employee = Employee(self.book,'EmployeeID',self.currency)
        self.job = Job(self.book,'JobID',self.customer)

        self.invoice = Invoice(self.book,'InvoiceID',self.currency,self.customer)
        self.invoice.SetDateOpened(self.today)
        entry = Entry(self.book)
        entry.SetDate(self.today)
        entry.SetDescription("Some income")
        entry.SetQuantity(GncNumeric(1))
        entry.SetInvAccount(self.income)
        entry.SetInvPrice(GncNumeric(100))
        self.invoice.AddEntry(entry)

        self.invoice.PostToAccount(self.receivable,
            self.today, self.today, "", True, False)
示例#2
0
 def setUp(self):
     self.domain1 = "gnc.engine"
     self.domain2 = "gnc.engine.scrub"
     level =  G_LOG_LEVEL_CRITICAL
     check1 = TestErrorStruct()
     check1.log_domain = self.domain1
     check1.log_level = level
     check1.msg = "[xaccScrubUtilityGetOrMakeAccount()] No currency specified!"
     test_add_error(check1)
     check2 = TestErrorStruct()
     check2.log_domain = self.domain1
     check2.log_level = level
     check2.msg = "[xaccTransScrubSplits()] Transaction doesn't have a currency!"
     test_add_error(check2)
     self.hdlr1 = test_set_list_handler(self.domain1, level, None)
     check3 = TestErrorStruct()
     check3.log_domain = "gnc.engine.scrub"
     check3.log_level = level
     check3.msg = "[xaccScrubUtilityGetOrMakeAccount()] No currency specified!"
     self.hdlr2 = test_set_checked_handler(self.domain2, level, check3)
     BookSession.setUp(self)
     self.trans = Transaction(self.book)
     #Evil bug means we must set a split for the transaction before making
     #any other changes (is slightly useful for later tests)
     self.split = Split(self.book)
     self.split.SetParent(self.trans)
     ############
     self.trans.SetCurrency(self.currency)
示例#3
0
 def setUp(self):
     self.domain1 = "gnc.engine"
     self.domain2 = "gnc.engine.scrub"
     level =  G_LOG_LEVEL_CRITICAL
     check1 = TestErrorStruct()
     check1.log_domain = self.domain1
     check1.log_level = level
     check1.msg = "[xaccScrubUtilityGetOrMakeAccount()] No currency specified!"
     test_add_error(check1)
     check2 = TestErrorStruct()
     check2.log_domain = self.domain1
     check2.log_level = level
     check2.msg = "[xaccTransScrubSplits()] Transaction doesn't have a currency!"
     test_add_error(check2)
     self.hdlr1 = test_set_list_handler(self.domain1, level, None)
     check3 = TestErrorStruct()
     check3.log_domain = "gnc.engine.scrub"
     check3.log_level = level
     check3.msg = "[xaccScrubUtilityGetOrMakeAccount()] No currency specified!"
     self.hdlr2 = test_set_checked_handler(self.domain2, level, check3)
     BookSession.setUp(self)
     self.trans = Transaction(self.book)
     #Evil bug means we must set a split for the transaction before making
     #any other changes (is slightly useful for later tests)
     self.split = Split(self.book)
     self.split.SetParent(self.trans)
     ############
     self.trans.SetCurrency(self.currency)
示例#4
0
 def setUp(self):
     BookSession.setUp(self)
     self.trans = Transaction(self.book)
     #Evil bug means we must set a split for the transaction before making
     #any other changes (is slightly useful for later tests)
     self.split = Split(self.book)
     self.split.SetParent(self.trans)
示例#5
0
 def setUp(self):
     BookSession.setUp(self)
     self.account = Account(self.book)
示例#6
0
    def setUp(self):

        BookSession.setUp(self)
        self.split = Split(self.book)
示例#7
0
    def setUp(self):

        BookSession.setUp(self)
        self.split = Split(self.book)