def test_write_record_new(self):
        """Test that we can create a new record."""
        entity = PipelineEntity.get_mock_object()

        PipelineRepository.write_record(PipelineMapper.to_record(entity))

        pipeline = PipelineRepository.fetch_pipeline_by_id(entity.id)
        self.assertEquals(pipeline.name, entity.name)
Example #2
0
    def write_pipeline(cls, pipeline_entity):
        """Writes a PipelineEntity to the database.

        :param PipelineEntity pipeline_entity:
        """
        pipeline_entity.validate()

        PipelineRepository.write_record(
            PipelineMapper.to_record(pipeline_entity)
        )
Example #3
0
    def test_to_record(self):
        """Test that an entity can be converted into a record."""
        entity = PipelineMapper.to_entity(self.pipeline)
        record = PipelineMapper.to_record(entity)

        for c in record.__table__.columns:
            self.assertEquals(
                getattr(record, c.name),
                getattr(self.pipeline, c.name),
            )
    def test_write_record_new(self):
        """Test that we can create a new record."""
        entity = PipelineEntity.get_mock_object()

        PipelineRepository.write_record(
            PipelineMapper.to_record(entity)
        )

        pipeline = PipelineRepository.fetch_pipeline_by_id(entity.id)
        self.assertEquals(pipeline.name, entity.name)