Beispiel #1
0
 def test_filter(self, where):
     Department.filter(max_results=25, start_position='1', Active=True)
     where.assert_called_once_with("Active = True",
                                   max_results=25,
                                   start_position='1',
                                   order_by='',
                                   qb=None)
Beispiel #2
0
 def test_all(self, where):
     Department.all()
     where.assert_called_once_with('',
                                   order_by='',
                                   max_results=100,
                                   start_position='',
                                   qb=None)
    def test_save_update(self, update_object):
        department = Department()
        department.Id = 1
        json = department.to_json()

        department.save()
        update_object.assert_called_once_with("Department", json)
Beispiel #4
0
 def test_where_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.where("Active=True",
                          start_position=1,
                          max_results=10,
                          qb=self.qb_client)
         self.assertTrue(query.called)
    def test_save_update_with_qb(self):
        with patch.object(self.qb_client, 'update_object') as update_object:
            department = Department()
            department.Id = 1
            json = department.to_json()

            department.save(qb=self.qb_client)
            self.assertTrue(update_object.called)
    def test_create(self):
        department = Department()
        department.Name = self.name
        department.save(qb=self.qb_client)

        query_department = Department.get(department.Id, qb=self.qb_client)

        self.assertEqual(department.Id, query_department.Id)
        self.assertEqual(query_department.Name, self.name)
    def test_update(self):
        department = Department.all(max_results=1, qb=self.qb_client)[0]
        unique_name = "Test Department {0}".format(datetime.now().strftime("%d%H%M%S"))

        department.Name = unique_name
        department.save(qb=self.qb_client)

        query_department = Department.get(department.Id, qb=self.qb_client)

        self.assertEqual(query_department.Name, unique_name)
    def test_to_ref(self):
        department = Department()
        department.Name = "test"
        department.Id = 100

        dept_ref = department.to_ref()

        self.assertEquals(dept_ref.name, "test")
        self.assertEquals(dept_ref.type, "Department")
        self.assertEquals(dept_ref.value, 100)
    def test_to_ref(self):
        department = Department()
        department.Name = "test"
        department.Id = 100

        dept_ref = department.to_ref()

        self.assertEqual(dept_ref.name, "test")
        self.assertEqual(dept_ref.type, "Department")
        self.assertEqual(dept_ref.value, 100)
    def test_update(self):
        department = Department.all(max_results=1, qb=self.qb_client)[0]
        unique_name = "Test Department {0}".format(
            datetime.now().strftime('%d%H%M%S'))

        department.Name = unique_name
        department.save(qb=self.qb_client)

        query_department = Department.get(department.Id, qb=self.qb_client)

        self.assertEqual(query_department.Name, unique_name)
Beispiel #11
0
    def test_save_update(self, update_object):
        department = Department()
        department.Id = 1
        json = department.to_json()

        department.save(qb=self.qb_client)
        update_object.assert_called_once_with("Department", json)
Beispiel #12
0
    def test_save_update_with_qb(self):
        with patch.object(self.qb_client, 'update_object') as update_object:
            department = Department()
            department.Id = 1
            json = department.to_json()

            department.save(qb=self.qb_client)
            self.assertTrue(update_object.called)
    def test_create(self):
        department = Department()
        department.Name = self.name
        department.save(qb=self.qb_client)

        query_department = Department.get(department.Id, qb=self.qb_client)

        self.assertEqual(department.Id, query_department.Id)
        self.assertEqual(query_department.Name, self.name)
Beispiel #14
0
 def test_save_create(self, create_object):
     department = Department()
     department.save(qb=self.qb_client)
     create_object.assert_called_once_with("Department",
                                           department.to_json())
Beispiel #15
0
 def test_get(self, get_single_object):
     Department.get(1)
     get_single_object.assert_called_once_with("Department", pk=1)
Beispiel #16
0
 def test_choose_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.choose(['name1', 'name2'],
                           field="Name",
                           qb=self.qb_client)
         self.assertTrue(query.called)
Beispiel #17
0
 def test_query_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         select = "SELECT * FROM Department WHERE Active=True"
         Department.query(select, qb=self.qb_client)
         self.assertTrue(query.called)
Beispiel #18
0
 def test_where_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.where("Active=True", 1, 10, qb=self.qb_client)
         self.assertTrue(query.called)
Beispiel #19
0
 def test_filter_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.filter(Active=True, qb=self.qb_client)
         self.assertTrue(query.called)
 def test_all(self, where):
     Department.all()
     where.assert_called_once_with("")
 def test_where_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.where("Active=True", 1, 10, qb=self.qb_client)
         self.assertTrue(query.called)
 def test_query_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         select = "SELECT * FROM Department WHERE Active=True"
         Department.query(select, qb=self.qb_client)
         self.assertTrue(query.called)
Beispiel #23
0
 def test_where_start_position_0(self, query):
     Department.where("Active=True", start_position=0, max_results=10)
     query.assert_called_once_with(
         "SELECT * FROM Department WHERE Active=True STARTPOSITION 0 MAXRESULTS 10",
         qb=None)
 def test_choose(self, where):
     Department.choose(['name1', 'name2'], field="Name")
     where.assert_called_once_with("Name in ('name1', 'name2')", qb=None)
 def test_choose_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.choose(['name1', 'name2'], field="Name", qb=self.qb_client)
         self.assertTrue(query.called)
 def test_filter_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.filter(Active=True, qb=self.qb_client)
         self.assertTrue(query.called)
 def test_all_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.all(qb=self.qb_client)
         self.assertTrue(query.called)
    def test_unicode(self):
        department = Department()
        department.Name = "test"

        self.assertEquals(str(department), "test")
 def test_get_with_qb(self):
     with patch.object(self.qb_client, 'get_single_object') as get_single_object:
         Department.get(1, qb=self.qb_client)
         self.assertTrue(get_single_object.called)
 def test_query(self, query):
     select = "select * from Department WHERE Active=True"
     Department.query(select)
     query.assert_called_once_with(select)
Beispiel #31
0
 def test_all_with_qb(self):
     with patch.object(self.qb_client, 'query') as query:
         Department.all(qb=self.qb_client)
         self.assertTrue(query.called)
 def test_all(self, where):
     Department.all()
     where.assert_called_once_with('', max_results=100, start_position='')
Beispiel #33
0
 def test_where(self, query):
     Department.where("Active=True", 1, 10)
     query.assert_called_once_with(
         "SELECT * FROM Department WHERE Active=True STARTPOSITION 1 MAXRESULTS 10",
         qb=None)
Beispiel #34
0
 def _get_location(self, sales_name):
     try:
         location = Department.filter(Name=sales_name, qb=self.client)[0]
         return location
     except:
         return None
Beispiel #35
0
 def test_query(self, query):
     select = "SELECT * FROM Department WHERE Active=True"
     Department.query(select)
     query.assert_called_once_with(select)
    def test_valid_object_name(self):
        obj = Department()
        client = QuickBooks()
        result = client.isvalid_object_name(obj.qbo_object_name)

        self.assertTrue(result)
Beispiel #37
0
 def test_choose(self, where):
     Department.choose(['name1', 'name2'], field="Name")
     where.assert_called_once_with("Name in ('name1', 'name2')", qb=None)
 def test_where(self, query):
     Department.where("Active=True")
     query.assert_called_once_with("select * from Department WHERE Active=True")
Beispiel #39
0
 def test_count(self, query):
     count = Department.count(where_clause="Active=True", qb=self.qb_client)
     query.assert_called_once_with(
         "SELECT COUNT(*) FROM Department WHERE Active=True")
 def test_get(self, get_single_object):
     Department.get(1)
     get_single_object.assert_called_once_with("Department", pk=1)
Beispiel #41
0
 def test_get_with_qb(self):
     with patch.object(self.qb_client,
                       'get_single_object') as get_single_object:
         Department.get(1, qb=self.qb_client)
         self.assertTrue(get_single_object.called)
 def test_save_create(self, create_object):
     department = Department()
     department.save()
     create_object.assert_called_once_with("Department", department.to_json())
Beispiel #43
0
 def test_save_create_with_qb(self):
     with patch.object(self.qb_client, 'create_object') as create_object:
         department = Department()
         department.save(qb=self.qb_client)
         self.assertTrue(create_object.called)
 def test_filter(self, where):
     Department.filter(Active=True)
     where.assert_called_once_with("Active = True")
 def test_filter(self, where):
     Department.filter(max_results=25, start_position='1', Active=True)
     where.assert_called_once_with("Active = True", max_results=25, start_position='1')
 def test_save_create_with_qb(self):
     with patch.object(self.qb_client, 'create_object') as create_object:
         department = Department()
         department.save(qb=self.qb_client)
         self.assertTrue(create_object.called)
 def test_where(self, query):
     Department.where("Active=True", 1, 10)
     query.assert_called_once_with("SELECT * FROM Department WHERE Active=True STARTPOSITION 1 MAXRESULTS 10")
 def test_query(self, query):
     select = "SELECT * FROM Department WHERE Active=True"
     Department.query(select)
     query.assert_called_once_with(select)
    def test_unicode(self):
        department = Department()
        department.Name = "test"

        self.assertEqual(str(department), "test")
 def test_choose_with_qb(self):
     with patch.object(self.qb_client, "query") as query:
         Department.choose(["name1", "name2"], field="Name", qb=self.qb_client)
         self.assertTrue(query.called)