def test_record_job_stop_time(self): """ Test that job stop time is recorded properly. """ cstats = JobStats(oq_job=self.job, start_time=datetime.utcnow(), num_sites=10) cstats.save(using='job_superv') supervisor.record_job_stop_time(self.job.id) # Fetch the stats and check for the stop_time cstats = JobStats.objects.get(oq_job=self.job.id) self.assertTrue(cstats.stop_time is not None)