コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    def test_unicode(self):
        customer = Customer()
        customer.DisplayName = "test"

        self.assertEquals(str(customer), "test")