Esempio n. 1
0
 def test_populater_updates(self):
     populater = Populater()
     populater.populate()
     for visit in SubjectVisit.objects.all():
         with self.subTest(report_datetime=visit.report_datetime):
             try:
                 Reference.objects.get(
                     identifier=self.subject_identifier,
                     model="reference_app.crfone",
                     report_datetime=visit.report_datetime,
                     field_name="field_int",
                     value_int=1,
                 )
             except ObjectDoesNotExist as e:
                 self.fail(f"Object unexpectedly DoesNotExist. Got {e}")
 def handle(self, *args, **options):
     names = options.get('names')
     exclude_names = options.get('exclude_names')
     skip_existing = options.get('skip_existing')
     skip_existing = None if skip_existing == NO else YES
     delete_existing = options.get('delete_existing')
     delete_existing = None if delete_existing == NO else YES
     summarize = options.get('summarize')
     summarize = None if summarize == NO else YES
     dry_run = options.get('dry_run')
     dry_run = None if dry_run == NO else YES
     populater = Populater(names=names,
                           exclude_names=exclude_names,
                           skip_existing=skip_existing,
                           delete_existing=delete_existing,
                           dry_run=dry_run)
     if summarize:
         populater.summarize()
     else:
         populater.populate()