コード例 #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
ファイル: pipeline.py プロジェクト: minglecm/ocelot
    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
ファイル: pipeline.py プロジェクト: minglecm/ocelot
    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,
     )