def test__identical_input(self): # The matching fragility model input is found expected = self._setup_input( input_type="fragility", size=123, path=self.FRAGM, digest=self.fragm_digest, jobs=self.jobs_u1) actual = engine._identical_input("fragility", self.fragm_digest, self.job.owner.id) self.assertEqual(expected.id, actual.id)
def test__identical_input_and_owner_differing_from_user(self): # The exposure model input is not found since its owner is not the user # that is running the current job. self._setup_input( input_type="exposure", size=123, path=self.EXPOM, digest="0" * 32, jobs=self.jobs_u2) actual = engine._identical_input("exposure", "0" * 32, self.job.owner.id) self.assertIs(None, actual)
def test__identical_input_and_failed_first_job(self): # The exposure model input is not found since the first job to have # used it has failed. self._setup_input( input_type="exposure", size=123, path=self.EXPOM, digest="0" * 32, jobs=self.failed_jobs_u1) actual = engine._identical_input("exposure", "0" * 32, self.job.owner.id) self.assertIs(None, actual)
def test__identical_input_and_non_matching_digest(self): # The exposure model input is not found since the md5sum digest does # not match. self._setup_input( input_type="exposure", size=123, path=self.EXPOM, digest="0" * 32, jobs=self.jobs_u1) actual = engine._identical_input("exposure", "x" * 32, self.job.owner.id) self.assertIs(None, actual)
def test__identical_input_and_no_match(self): # The exposure model input is not found since the md5sum digest does # not match. actual = engine._identical_input("exposure", "x" * 32) self.assertIs(None, actual)
def test__identical_input(self): # The matching fragility model input is found expected = self.fmdl_input actual = engine._identical_input("fragility", expected.digest) self.assertEqual(expected.id, actual.id)