Exemplo n.º 1
0
 def test_del_haz_calc_no_access(self):
     # Test the case where we try to delete a hazard calculation which does
     # not belong to current user.
     # In this case, deletion is now allowed and should raise an exception.
     hazard_job = helpers.get_job(
         self.hazard_cfg, username=helpers.random_string())
     self.assertRaises(RuntimeError, engine.del_haz_calc, hazard_job.id)
Exemplo n.º 2
0
 def test_del_calc_no_access(self):
     # Test the case where we try to delete a hazard calculation which does
     # not belong to current user.
     # In this case, deletion is now allowed and should raise an exception.
     hazard_job = helpers.get_job(self.hazard_cfg,
                                  username=helpers.random_string())
     self.assertRaises(RuntimeError, engine.del_calc, hazard_job.id)
Exemplo n.º 3
0
 def test_del_calc_no_access(self):
     # Test the case where we try to delete a risk calculation which does
     # not belong to current user.
     # In this case, deletion is now allowed and should raise an exception.
     risk_job = get_job(self.risk_cfg, helpers.random_string(),
                        hazard_calculation_id=self.job.id)
     self.assertRaises(RuntimeError, actions.del_calc, risk_job.id)
Exemplo n.º 4
0
 def test_del_calc_no_access(self):
     # Test the case where we try to delete a risk calculation which does
     # not belong to current user.
     # In this case, deletion is now allowed and should raise an exception.
     risk_job = get_job(self.risk_cfg,
                        helpers.random_string(),
                        hazard_calculation_id=self.job.id)
     self.assertRaises(RuntimeError, actions.del_calc, risk_job.id)
Exemplo n.º 5
0
 def test_del_calc_no_access(self):
     # Test the case where we try to delete a risk calculation which does
     # not belong to current user.
     # In this case, deletion is now allowed and should raise an exception.
     risk_job, _ = helpers.get_fake_risk_job(
         self.risk_cfg, self.hazard_cfg,
         output_type='curve', username=helpers.random_string()
     )
     self.assertRaises(RuntimeError, engine.del_calc, risk_job.id)
Exemplo n.º 6
0
    def test_prepare_job_specified_user(self):
        user_name = helpers.random_string()
        job = engine.prepare_job(user_name=user_name)

        self.assertEqual(user_name, job.user_name)
        self.assertEqual('pre_executing', job.status)
        self.assertEqual('progress', job.log_level)

        try:
            models.OqJob.objects.get(id=job.id)
        except exceptions.ObjectDoesNotExist:
            self.fail('Job was not found in the database')
Exemplo n.º 7
0
    def test_create_job_specified_user(self):
        user_name = helpers.random_string()
        job = engine.create_job(user_name=user_name)

        self.assertEqual(user_name, job.user_name)
        self.assertEqual('pre_executing', job.status)
        self.assertEqual('progress', job.log_level)

        try:
            models.OqJob.objects.get(id=job.id)
        except exceptions.ObjectDoesNotExist:
            self.fail('Job was not found in the database')
Exemplo n.º 8
0
    def test_create_job_specified_user(self):
        user_name = helpers.random_string()
        job = actions.create_job(
            'classical', 'test_create_job_specified_user', user_name=user_name)

        self.assertEqual(user_name, job.user_name)
        self.assertEqual('executing', job.status)

        try:
            models.OqJob.objects.get(id=job.id)
        except exceptions.ObjectDoesNotExist:
            self.fail('Job was not found in the database')
Exemplo n.º 9
0
    def test_create_job_specified_user(self):
        user_name = helpers.random_string()
        job = actions.create_job('classical',
                                 'test_create_job_specified_user',
                                 user_name=user_name)

        self.assertEqual(user_name, job.user_name)
        self.assertEqual('executing', job.status)

        try:
            models.OqJob.objects.get(id=job.id)
        except exceptions.ObjectDoesNotExist:
            self.fail('Job was not found in the database')