Exemple #1
0
    def test(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', 'oq.log', ['xml', 'geojson'])

            self.assertEqual(1, self.mocks['touch'].call_count)
            self.assertEqual((('oq.log',), {}), self.mocks['touch'].call_args)

            self.assertEqual(1, self.mocks['job'].call_count)
            self.assertEqual(
                (('job.ini', getpass.getuser(), 'debug', ['xml', 'geojson']),
                 {}),
                self.mocks['job'].call_args
            )

            self.assertEqual(1, self.mocks['run'].call_count)
            self.assertEqual(
                ((self.job, 'debug', 'oq.log', ['xml', 'geojson'], 'hazard'),
                 {}),
                self.mocks['run'].call_args
            )

            self.assertEqual(1, self.mocks['list'].call_count)
Exemple #2
0
    def test(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', 'oq.log', ['xml', 'geojson'])

            self.assertEqual(1, self.mocks['touch'].call_count)
            self.assertEqual((('oq.log',), {}), self.mocks['touch'].call_args)

            self.assertEqual(1, self.mocks['job'].call_count)
            self.assertEqual(
                (('job.ini', getpass.getuser(), 'debug', ['xml', 'geojson']),
                 {}),
                self.mocks['job'].call_args
            )

            self.assertEqual(1, self.mocks['run'].call_count)
            self.assertEqual(
                ((self.job, 'debug', 'oq.log', ['xml', 'geojson'], 'hazard'),
                 {}),
                self.mocks['run'].call_args
            )

            self.assertEqual(1, self.mocks['list'].call_count)
Exemple #3
0
    def test_no_log(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', None, ['xml', 'geojson'])

            self.assertEqual(0, self.mocks['touch'].call_count)
Exemple #4
0
    def test_no_log(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', None, ['xml', 'geojson'])

            self.assertEqual(0, self.mocks['touch'].call_count)
Exemple #5
0
    def test_job_not_complete(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.complete_job.status = 'executing'
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', 'oq.log', ['xml', 'geojson'])

            self.assertEqual(0, self.mocks['list'].call_count)
            self.assertEqual(1, self.mocks['complain'].call_count)
Exemple #6
0
    def test_job_not_complete(self):
        with self.mocks:
            self.mocks['job'].return_value = self.job
            self.complete_job.status = 'executing'
            self.mocks['run'].return_value = self.complete_job

            engine.run_hazard('job.ini', 'debug', 'oq.log', ['xml', 'geojson'])

            self.assertEqual(0, self.mocks['list'].call_count)
            self.assertEqual(1, self.mocks['complain'].call_count)