Пример #1
0
    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)
Пример #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)
        )
Пример #3
0
    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)
Пример #4
0
    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')
Пример #5
0
    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')
Пример #6
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),
        )
Пример #7
0
 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,
     )
Пример #8
0
 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,
     )