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)
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_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_save_create(self, create_object): department = Department() department.save(qb=self.qb_client) create_object.assert_called_once_with("Department", department.to_json())