Exemplo n.º 1
0
 def test_to_entity(self):
     """Test that a record can be converted into an entity."""
     self.assertEquals(
         PipelineMapper.to_entity(self.pipeline).to_native(),
         {
             'id': self.pipeline.id,
             'name': self.pipeline.name,
         }
     )
Exemplo n.º 2
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),
        )
Exemplo n.º 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),
            )