Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cca772

Browse files
author
Jason Otero
committed
Added objects to customer integration test
1 parent e0bf7e9 commit 0cca772

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

tests/integration/test_customer.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import unittest
44

5+
from quickbooks.objects.base import Address, PhoneNumber, EmailAddress
6+
57
from quickbooks.objects.customer import Customer
68

79
from quickbooks import QuickBooks
@@ -37,9 +39,22 @@ def test_create(self):
3739
customer.FullyQualifiedName = self.fully_qualified_name
3840
customer.CompanyName = self.company_name
3941
customer.DisplayName = self.display_name
40-
customer.save(qb=self.qb_client)
4142

42-
self.Id = customer.Id
43+
customer.BillAddr = Address()
44+
customer.BillAddr.Line1 = "123 Main"
45+
customer.BillAddr.Line2 = "Apartment 1"
46+
customer.BillAddr.City = "City"
47+
customer.BillAddr.Country = "U.S.A"
48+
customer.BillAddr.CountrySubDivisionCode = "CA"
49+
customer.BillAddr.PostalCode = "94030"
50+
51+
customer.PrimaryPhone = PhoneNumber()
52+
customer.PrimaryPhone.FreeFormNumber = '555-555-5555'
53+
54+
customer.PrimaryEmailAddr = EmailAddress()
55+
customer.PrimaryEmailAddr.Address = '[email protected]'
56+
57+
customer.save(qb=self.qb_client)
4358

4459
query_customer = Customer.get(customer.Id, qb=self.qb_client)
4560

@@ -52,6 +67,14 @@ def test_create(self):
5267
self.assertEqual(query_customer.FullyQualifiedName, self.fully_qualified_name)
5368
self.assertEqual(query_customer.CompanyName, self.company_name)
5469
self.assertEqual(query_customer.DisplayName, self.display_name)
70+
self.assertEqual(query_customer.BillAddr.Line1, customer.BillAddr.Line1)
71+
self.assertEqual(query_customer.BillAddr.Line2, customer.BillAddr.Line2)
72+
self.assertEqual(query_customer.BillAddr.City, customer.BillAddr.City)
73+
self.assertEqual(query_customer.BillAddr.Country, customer.BillAddr.Country)
74+
self.assertEqual(query_customer.BillAddr.CountrySubDivisionCode, customer.BillAddr.CountrySubDivisionCode)
75+
self.assertEqual(query_customer.BillAddr.PostalCode, customer.BillAddr.PostalCode)
76+
self.assertEqual(query_customer.PrimaryPhone.FreeFormNumber, customer.PrimaryPhone.FreeFormNumber)
77+
self.assertEqual(query_customer.PrimaryEmailAddr.Address, customer.PrimaryEmailAddr.Address)
5578

5679
def test_update(self):
5780
customer = Customer.all(max_results=1, qb=self.qb_client)[0]

tests/unit/objects/test_customer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ def test_valid_object_name(self):
2727
client = QuickBooks()
2828
result = client.isvalid_object_name(obj.qbo_object_name)
2929

30-
self.assertTrue(result)
30+
self.assertTrue(result)

0 commit comments

Comments
 (0)