def test_to_record(self): """Test that an entity can be converted into a record.""" entity = PipelineScheduleMapper.to_entity(self.pipeline_schedule_cron) record = PipelineScheduleMapper.to_record(entity) for c in record.__table__.columns: self.assertEquals( getattr(record, c.name), getattr(self.pipeline_schedule_cron, c.name), )
def _write_entity(cls, entity): """Writes an entity to the repository. :param PipelineScheduleEntity entity: """ PipelineScheduleRepository.write_record( PipelineScheduleMapper.to_record(entity), )
def fetch_schedule_for_pipeline(cls, pipeline_id): """Returns a PipelineScheduleEntity for a pipeline_id. :param str pipeline_id: :returns PipelineScheduleEntity: :raises ResourceNotFoundException: if not found """ return PipelineScheduleMapper.to_entity( PipelineScheduleRepository.fetch_schedule_for_pipeline( pipeline_id, ), )
def test_to_entity(self): """Test that a record can be converted into an entity.""" self.assertEquals( PipelineScheduleMapper.to_entity( self.pipeline_schedule_cron).to_native(), { 'pipeline_id': self.pipeline_schedule_cron.pipeline_id, 'schedule': self.pipeline_schedule_cron.schedule, 'type': self.pipeline_schedule_cron.type, 'next_run_at': self.pipeline_schedule_cron.next_run_at, 'last_run_at': self.pipeline_schedule_cron.last_run_at, 'locked': self.pipeline_schedule_cron.locked, })
def test_to_entity(self): """Test that a record can be converted into an entity.""" self.assertEquals( PipelineScheduleMapper.to_entity(self.pipeline_schedule_cron).to_native(), { 'pipeline_id': self.pipeline_schedule_cron.pipeline_id, 'schedule': self.pipeline_schedule_cron.schedule, 'type': self.pipeline_schedule_cron.type, 'next_run_at': self.pipeline_schedule_cron.next_run_at, 'last_run_at': self.pipeline_schedule_cron.last_run_at, 'locked': self.pipeline_schedule_cron.locked, } )