Exemplo n.º 1
0
    def test_create(self):
        employee = Employee()
        employee.SSN = "444-55-6666"
        employee.GivenName = "John"
        employee.FamilyName = "Smith {0}".format(
            datetime.now().strftime('%d%H%M%S'))

        employee.PrimaryAddr = Address()
        employee.PrimaryAddr.Line1 = "45 N. Elm Street"
        employee.PrimaryAddr.City = "Middlefield"
        employee.PrimaryAddr.CountrySubDivisionCode = "CA"
        employee.PrimaryAddr.PostalCode = "93242"

        employee.PrimaryPhone = PhoneNumber()
        employee.PrimaryPhone.FreeFormNumber = "408-525-1234"
        employee.save(qb=self.qb_client)

        query_employee = Employee.get(employee.Id, qb=self.qb_client)

        self.assertEqual(query_employee.Id, employee.Id)
        self.assertEqual(query_employee.SSN, "XXX-XX-XXXX")
        self.assertEqual(query_employee.GivenName, employee.GivenName)
        self.assertEqual(query_employee.FamilyName, employee.FamilyName)
        self.assertEqual(query_employee.PrimaryAddr.Line1,
                         employee.PrimaryAddr.Line1)
        self.assertEqual(query_employee.PrimaryAddr.City,
                         employee.PrimaryAddr.City)
        self.assertEqual(query_employee.PrimaryAddr.CountrySubDivisionCode,
                         employee.PrimaryAddr.CountrySubDivisionCode)
        self.assertEqual(query_employee.PrimaryAddr.PostalCode,
                         employee.PrimaryAddr.PostalCode)
        self.assertEqual(query_employee.PrimaryPhone.FreeFormNumber,
                         employee.PrimaryPhone.FreeFormNumber)
Exemplo n.º 2
0
    def test_to_ref(self):
        employee = Employee()
        employee.DisplayName = "test"
        employee.Id = 100

        ref = employee.to_ref()

        self.assertEqual(ref.name, "test")
        self.assertEqual(ref.type, "Employee")
        self.assertEqual(ref.value, 100)
Exemplo n.º 3
0
    def test_to_ref(self):
        employee = Employee()
        employee.DisplayName = "test"
        employee.Id = 100

        ref = employee.to_ref()

        self.assertEquals(ref.name, "test")
        self.assertEquals(ref.type, "Employee")
        self.assertEquals(ref.value, 100)
Exemplo n.º 4
0
    def test_update(self):
        employee = Employee.all(max_results=1, qb=self.qb_client)[0]
        unique_name = employee.FamilyName = "Smith Updated {0}".format(datetime.now().strftime("%d%H%M%S"))

        employee.FamilyName = unique_name
        employee.save(qb=self.qb_client)

        query_employee = Employee.get(employee.Id, qb=self.qb_client)

        self.assertEqual(query_employee.FamilyName, unique_name)
Exemplo n.º 5
0
    def test_update(self):
        employee = Employee.all(max_results=1, qb=self.qb_client)[0]
        unique_name = employee.FamilyName = "Smith Updated {0}".format(datetime.now().strftime('%d%H%M%S'))

        employee.FamilyName = unique_name
        employee.save(qb=self.qb_client)

        query_employee = Employee.get(employee.Id, qb=self.qb_client)

        self.assertEqual(query_employee.FamilyName, unique_name)
Exemplo n.º 6
0
    def test_create(self):
        employee = Employee()
        employee.SSN = "444-55-6666"
        employee.GivenName = "John"
        employee.FamilyName = "Smith {0}".format(datetime.now().strftime("%d%H%M%S"))

        employee.PrimaryAddr = Address()
        employee.PrimaryAddr.Line1 = "45 N. Elm Street"
        employee.PrimaryAddr.City = "Middlefield"
        employee.PrimaryAddr.CountrySubDivisionCode = "CA"
        employee.PrimaryAddr.PostalCode = "93242"

        employee.PrimaryPhone = PhoneNumber()
        employee.PrimaryPhone.FreeFormNumber = "408-525-1234"
        employee.save(qb=self.qb_client)

        query_employee = Employee.get(employee.Id, qb=self.qb_client)

        self.assertEqual(query_employee.Id, employee.Id)
        self.assertEqual(query_employee.SSN, "XXX-XX-XXXX")
        self.assertEqual(query_employee.GivenName, employee.GivenName)
        self.assertEqual(query_employee.FamilyName, employee.FamilyName)
        self.assertEqual(query_employee.PrimaryAddr.Line1, employee.PrimaryAddr.Line1)
        self.assertEqual(query_employee.PrimaryAddr.City, employee.PrimaryAddr.City)
        self.assertEqual(query_employee.PrimaryAddr.CountrySubDivisionCode, employee.PrimaryAddr.CountrySubDivisionCode)
        self.assertEqual(query_employee.PrimaryAddr.PostalCode, employee.PrimaryAddr.PostalCode)
        self.assertEqual(query_employee.PrimaryPhone.FreeFormNumber, employee.PrimaryPhone.FreeFormNumber)
Exemplo n.º 7
0
    def test_create(self):
        employee = Employee.all(max_results=1, qb=self.qb_client)[0]

        time_activity = TimeActivity()
        time_activity.NameOf = "Employee"

        time_activity.EmployeeRef = employee.to_ref()
        time_activity.Description = "Test description"
        time_activity.StartTime = qb_datetime_utc_offset_format(datetime(2016, 7, 22, 10, 0), '-07:00')
        time_activity.EndTime = qb_datetime_utc_offset_format(datetime(2016, 7, 22, 11, 0), '-07:00')
        time_activity.save(qb=self.qb_client)

        query_time_activity = TimeActivity.get(time_activity.Id, qb=self.qb_client)

        self.assertEqual(query_time_activity.Id, time_activity.Id)
        self.assertEqual(query_time_activity.NameOf, "Employee")
        self.assertEqual(query_time_activity.Description, "Test description")
        self.assertEqual(query_time_activity.EmployeeRef.value, employee.Id)
Exemplo n.º 8
0
    def test_create(self):
        employee = Employee.all(max_results=1, qb=self.qb_client)[0]

        time_activity = TimeActivity()
        time_activity.NameOf = "Employee"

        time_activity.EmployeeRef = employee.to_ref()
        time_activity.Description = "Test description"
        time_activity.StartTime = qb_datetime_utc_offset_format(datetime(2016, 7, 22, 10, 0), '-07:00')
        time_activity.EndTime = qb_datetime_utc_offset_format(datetime(2016, 7, 22, 11, 0), '-07:00')
        time_activity.save(qb=self.qb_client)

        query_time_activity = TimeActivity.get(time_activity.Id, qb=self.qb_client)

        self.assertEquals(query_time_activity.Id, time_activity.Id)
        self.assertEquals(query_time_activity.NameOf, "Employee")
        self.assertEquals(query_time_activity.Description, "Test description")
        self.assertEquals(query_time_activity.EmployeeRef.value, employee.Id)
Exemplo n.º 9
0
    def test_unicode(self):
        employee = Employee()
        employee.DisplayName = "test"

        self.assertEqual(str(employee), "test")
Exemplo n.º 10
0
    def test_valid_object_name(self):
        obj = Employee()
        client = QuickBooks()
        result = client.isvalid_object_name(obj.qbo_object_name)

        self.assertTrue(result)
Exemplo n.º 11
0
    def test_unicode(self):
        employee = Employee()
        employee.DisplayName = "test"

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