示例#1
0
    def test_to_LinkedTxn(self):
        bill = Bill()
        bill.Id = 10

        linked_txn = bill.to_linked_txn()

        self.assertEquals(linked_txn.TxnId, bill.Id)
        self.assertEquals(linked_txn.TxnType, "Bill")
        self.assertEquals(linked_txn.TxnLineId, 1)
示例#2
0
    def test_to_ref(self):
        bill = Bill()
        bill.DocNumber = "test"
        bill.Id = 100

        ref = bill.to_ref()

        self.assertEquals(ref.name, "test")
        self.assertEquals(ref.type, "Bill")
        self.assertEquals(ref.value, 100)
    def test_create(self):
        bill = Bill()

        line = AccountBasedExpenseLine()
        line.Amount = 200
        line.DetailType = "AccountBasedExpenseLineDetail"

        account_ref = Ref()
        account_ref.type = "Account"
        account_ref.value = 1
        line.AccountBasedExpenseLineDetail = AccountBasedExpenseLineDetail()
        line.AccountBasedExpenseLineDetail.AccountRef = account_ref
        bill.Line.append(line)

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]
        bill.VendorRef = vendor.to_ref()

        bill.save(qb=self.qb_client)

        query_bill = Bill.get(bill.Id, qb=self.qb_client)

        self.assertEquals(query_bill.Id, bill.Id)
        self.assertEquals(len(query_bill.Line), 1)
        self.assertEquals(query_bill.Line[0].Amount, 200.0)
示例#4
0
    def test_unicode(self):
        bill = Bill()
        bill.Balance = 1000

        self.assertEquals(str(bill), "1000")
示例#5
0
    def test_valid_object_name(self):
        obj = Bill()
        client = QuickBooks()
        result = client.isvalid_object_name(obj.qbo_object_name)

        self.assertTrue(result)