def test_requires_is_empty(self): interval = luigi.DateIntervalParameter().parse('2013-12-17-2014-01-15') task = CreateAllEnrollmentValidationEventsTask( interval=interval, output_root=self.output_root, warehouse_path=self.output_root, ) required = task.requires() self.assertEquals(required, [])
def test_requires_includes_today(self): today_datestring = datetime.datetime.utcnow().strftime('%Y-%m-%d') fake_param = luigi.DateIntervalParameter() interval_string = '2013-12-17-{}'.format(today_datestring) interval = fake_param.parse(interval_string) task = CreateAllEnrollmentValidationEventsTask( interval=interval, output_root=self.output_root, warehouse_path=self.output_root, ) required = task.requires() self.assertTrue(any([isinstance(dep, CreateEnrollmentValidationEventsForTodayTask) for dep in required]))
def test_requires_includes_today(self): today_datestring = datetime.datetime.utcnow().strftime('%Y-%m-%d') fake_param = luigi.DateIntervalParameter() interval_string = '2013-12-17-{}'.format(today_datestring) interval = fake_param.parse(interval_string) task = CreateAllEnrollmentValidationEventsTask( interval=interval, output_root=self.output_root, warehouse_path=self.output_root, ) required = task.requires() self.assertTrue( any([ isinstance(dep, CreateEnrollmentValidationEventsForTodayTask) for dep in required ]))
def test_requires_is_not_empty(self): interval = luigi.DateIntervalParameter().parse('2013-12-17-2014-01-15') warehouse_path = self.output_root source_dir = os.path.join(warehouse_path, "student_courseenrollment", "dt=2014-01-01") os.makedirs(source_dir) self.assertTrue(os.path.exists(source_dir)) task = CreateAllEnrollmentValidationEventsTask( interval=interval, output_root=self.output_root, warehouse_path=warehouse_path, ) required = task.requires() self.assertEquals(len(required), 1) one_required = required[0] self.assertTrue(one_required.source_dir, source_dir) self.assertTrue(one_required.output_root, self.output_root)