Esempio n. 1
0
    def test_write_and_run_slice_files(self):
        """test that we can slice model using the slicer factory.
        """

        # setUp has set the variables we need to test this method
        # Test writing files to disk and making a DB entry
        result, message, self.slice_id = SliceBase.write_slice_files(
                self.email, self.slicer, self.version, self.model_filename,
                self.model_raw, self.config_filename, self.config_raw)

        logging.info('message: %s' % message)

        self.assertTrue(result)

        output_filename = re.sub('\.\w+', '', self.model_filename)
        output_filename += '.gcode'

        # Build paths
        slice_folder = os.path.join(os.getcwd(), 'slices', self.slice_id)
        stl_path = os.path.join(slice_folder, self.model_filename)
        config_path = os.path.join(slice_folder, self.config_filename)
        output_path = output_filename

        # Test able to slice job
        result = SliceBase.slice_job_files(
                self.email, self.slicer, self.version, stl_path, config_path,
                output_path, self.slice_id)

        self.assertTrue(result)
Esempio n. 2
0
    def test_write_and_run_slice_files(self):
        """test that we can slice model using the slicer factory.
        """

        # setUp has set the variables we need to test this method
        # Test writing files to disk and making a DB entry
        result, message, self.slice_id = SliceBase.write_slice_files(
            self.email, self.slicer, self.version, self.model_filename,
            self.model_raw, self.config_filename, self.config_raw)

        logging.info('message: %s' % message)

        self.assertTrue(result)

        output_filename = re.sub('\.\w+', '', self.model_filename)
        output_filename += '.gcode'

        # Build paths
        slice_folder = os.path.join(os.getcwd(), 'slices', self.slice_id)
        stl_path = os.path.join(slice_folder, self.model_filename)
        config_path = os.path.join(slice_folder, self.config_filename)
        output_path = output_filename

        # Test able to slice job
        result = SliceBase.slice_job_files(self.email, self.slicer,
                                           self.version, stl_path, config_path,
                                           output_path, self.slice_id)

        self.assertTrue(result)
Esempio n. 3
0
    def test_celery_process_task(self):
        """Test the actual celery process by firing it off.

        Requires a celery worker and mongodb to be running. See the shell
        scripts in the celerystalk module. Will expand setup to make the call
        to spin up a celery worker for testing.
        """

        for i in range(100):
            slice_job = create_dummy_job()

            result = SliceBase.write_files(
                slice_job.job_id, self.model_raw, self.config_raw,
                self.model_filename, self.config_filename)

            self.assertTrue(result)

            job = models.get_job_by_id(slice_job.job_id)
            self.assertIsNotNone(job)
            logging.info('starting task tests')
            tasks.process_job.delay(slice_job.job_id, self.slicer, self.version)
Esempio n. 4
0
def process_slice_request(request):
	"""
	"""
	return SliceBase.process_slice_request(request)