def setUp(self): self.importer = EardErmsImporter() self.archive = mock.Mock() self.archive.pk = uuid.uuid4() self.ip = mock.Mock() self.ip.pk = uuid.uuid4() self.importer.task = mock.Mock() self.importer.task.pk = uuid.uuid4() self.structure = Structure.objects.create() self.structure_unit = StructureUnit.objects.create( structure=self.structure, reference_code='some_klass_ref_2')
def setUp(self): self.importer = EardErmsImporter() self.archive = mock.Mock() self.archive.pk = uuid.uuid4() self.ip = mock.Mock() self.ip.pk = uuid.uuid4() self.importer.task = mock.Mock() self.importer.task.pk = uuid.uuid4() self.errand = mock.Mock() self.errand.meta.id = 'some_errand_meta_id' self.errand._index._name = 'some_errand_index_name' self.errand.archive = self.archive.pk self.errand.ip = self.ip.pk
def test_update_progress_is_updating_the_task_progress_in_database(self): self.importer = EardErmsImporter() task = ProcessTask.objects.create(name="example.Foo", args=[1], params={'bar': 'baz'}, progress=0) self.importer.task = task self.assertEqual(task.progress, 0) self.importer.update_progress(20) task.refresh_from_db() self.assertEqual(task.progress, 20) self.importer.update_progress(40) task.refresh_from_db() self.assertEqual(task.progress, 40) self.importer.update_progress(66.66) task.refresh_from_db() self.assertEqual(task.progress, 66)
def setUp(self): self.importer = EardErmsImporter()