def setUp(self): self.qb = client.QuickBooks( sandbox=False, consumer_key="consumer_key", consumer_secret="consumer_secret", access_token="access_token", access_token_secret="access_token_secret", company_id="company_id", callback_url="callback_url", verbose=True ) self.object1 = Customer() self.object2 = Customer() self.obj_list = [self.object1, self.object2]
def test_to_ref(self): customer = Customer() customer.DisplayName = "test" customer.Id = 100 ref = customer.to_ref() self.assertEquals(ref.name, "test") self.assertEquals(ref.type, "Customer") self.assertEquals(ref.value, 100)
def test_create(self): customer = Customer() customer.Title = self.title customer.GivenName = self.given_name customer.MiddleName = self.middle_name customer.FamilyName = self.family_name customer.Suffix = self.suffix customer.FullyQualifiedName = self.fully_qualified_name customer.CompanyName = self.company_name customer.DisplayName = self.display_name customer.BillAddr = Address() customer.BillAddr.Line1 = "123 Main" customer.BillAddr.Line2 = "Apartment 1" customer.BillAddr.City = "City" customer.BillAddr.Country = "U.S.A" customer.BillAddr.CountrySubDivisionCode = "CA" customer.BillAddr.PostalCode = "94030" customer.PrimaryPhone = PhoneNumber() customer.PrimaryPhone.FreeFormNumber = '555-555-5555' customer.PrimaryEmailAddr = EmailAddress() customer.PrimaryEmailAddr.Address = '*****@*****.**' customer.save(qb=self.qb_client) query_customer = Customer.get(customer.Id, qb=self.qb_client) self.assertEquals(customer.Id, query_customer.Id) self.assertEqual(query_customer.Title, self.title) self.assertEqual(query_customer.GivenName, self.given_name) self.assertEqual(query_customer.MiddleName, self.middle_name) self.assertEqual(query_customer.FamilyName, self.family_name) self.assertEqual(query_customer.Suffix, self.suffix) self.assertEqual(query_customer.FullyQualifiedName, self.fully_qualified_name) self.assertEqual(query_customer.CompanyName, self.company_name) self.assertEqual(query_customer.DisplayName, self.display_name) self.assertEqual(query_customer.BillAddr.Line1, customer.BillAddr.Line1) self.assertEqual(query_customer.BillAddr.Line2, customer.BillAddr.Line2) self.assertEqual(query_customer.BillAddr.City, customer.BillAddr.City) self.assertEqual(query_customer.BillAddr.Country, customer.BillAddr.Country) self.assertEqual(query_customer.BillAddr.CountrySubDivisionCode, customer.BillAddr.CountrySubDivisionCode) self.assertEqual(query_customer.BillAddr.PostalCode, customer.BillAddr.PostalCode) self.assertEqual(query_customer.PrimaryPhone.FreeFormNumber, customer.PrimaryPhone.FreeFormNumber) self.assertEqual(query_customer.PrimaryEmailAddr.Address, customer.PrimaryEmailAddr.Address)
def test_unicode(self): customer = Customer() customer.DisplayName = "test" self.assertEquals(str(customer), "test")
def test_valid_object_name(self): obj = Customer() client = QuickBooks() result = client.isvalid_object_name(obj.qbo_object_name) self.assertTrue(result)