Beispiel #1
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)
        )
    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)
    def test_write_record_update(self):
        """Test that we can write an updated record."""
        # Assert pipeline name is not 'new name'
        pipeline = PipelineRepository.fetch_pipeline_by_id(self.pipeline.id)
        self.assertNotEquals(pipeline.name, 'new name')

        # Update pipeline's name
        pipeline.name = 'new name'
        PipelineRepository.write_record(pipeline)

        # Pipeline's name should be 'new name'
        pipeline = PipelineRepository.fetch_pipeline_by_id(self.pipeline.id)
        self.assertEquals(pipeline.name, 'new name')
Beispiel #4
0
    def fetch_pipeline_by_id(cls, id):
        """Returns PipelineEntity by id.

        :param str id:
        :returns PipelineEntity:
        """
        return PipelineMapper.to_entity(
            PipelineRepository.fetch_pipeline_by_id(id),
        )
 def test_fetch_pipeline_by_id(self):
     """Test that a record can be retrieved from the datastore."""
     self.assertEquals(
         PipelineRepository.fetch_pipeline_by_id(self.pipeline.id),
         self.pipeline,
     )