Example #1
0
class InOutProcessingTest(unittest.TestCase):
    """Processing test case with InOut process"""

    def setUp(self):
        self.uuid = uuid.uuid1()
        self.dummy_process = InOut()
        self.dummy_process._set_uuid(self.uuid)
        self.dummy_process.set_workdir('/tmp')
        self.wps_request = WPSRequest()
        self.wps_response = ExecuteResponse(self.wps_request, self.uuid,
                                            process=self.dummy_process)
        self.job = Job(
            process=self.dummy_process,
            wps_request=self.wps_request,
            wps_response=self.wps_response)

    def test_job_json(self):
        new_job = Job.from_json(json.loads(self.job.json))
        self.assertEqual(new_job.name, 'inout')
        self.assertEqual(new_job.uuid, str(self.uuid))
        self.assertEqual(new_job.workdir, '/tmp')
        self.assertEqual(len(new_job.process.inputs), 3)
        self.assertEqual(new_job.json, self.job.json)  # idempotent test

    def test_job_dump(self):
        new_job = Job.load(self.job.dump())
        self.assertEqual(new_job.name, 'inout')
        self.assertEqual(new_job.uuid, str(self.uuid))
        self.assertEqual(new_job.workdir, '/tmp')
        self.assertEqual(len(new_job.process.inputs), 3)
        self.assertEqual(new_job.json, self.job.json)  # idempotent test
Example #2
0
class GreeterProcessingTest(unittest.TestCase):
    """Processing test case with Greeter process"""

    def setUp(self):
        self.uuid = uuid.uuid1()
        self.dummy_process = Greeter()
        self.dummy_process._set_uuid(self.uuid)
        self.dummy_process.set_workdir('/tmp')
        self.wps_request = WPSRequest()
        self.wps_response = ExecuteResponse(self.wps_request, self.uuid,
                                            process=self.dummy_process)
        self.job = Job(
            process=self.dummy_process,
            wps_request=self.wps_request,
            wps_response=self.wps_response)

    def test_default_mode(self):
        """Test pywps.formats.Format class
        """
        self.assertEqual(configuration.get_config_value('processing', 'mode'),
                         'default')
        process = pywps.processing.Process(
            process=self.dummy_process,
            wps_request=self.wps_request,
            wps_response=self.wps_response)
        # process.start()
        self.assertTrue(isinstance(process, MultiProcessing))

    def test_job_json(self):
        new_job = Job.from_json(json.loads(self.job.json))
        self.assertEqual(new_job.name, 'greeter')
        self.assertEqual(new_job.uuid, str(self.uuid))
        self.assertEqual(new_job.workdir, '/tmp')
        self.assertEqual(len(new_job.process.inputs), 1)

    def test_job_dump(self):
        new_job = Job.load(self.job.dump())
        self.assertEqual(new_job.name, 'greeter')
        self.assertEqual(new_job.uuid, str(self.uuid))
        self.assertEqual(new_job.workdir, '/tmp')
        self.assertEqual(len(new_job.process.inputs), 1)