def test_to_record(self):
        """Test that an entity can be converted into a record."""
        entity = TaskConnectionMapper.to_entity(self.url_to_log_connection)
        record = TaskConnectionMapper.to_record(entity)

        for c in record.__table__.columns:
            self.assertEquals(
                getattr(record, c.name),
                getattr(self.url_to_log_connection, c.name),
            )
예제 #2
0
    def write_task_connection(cls, task_connection_entity):
        """Writes a TaskConnectionEntity to the database.

        :param TaskConnectionEntity task_connection_entity:
        """
        task_connection_entity.validate()

        TaskConnectionRepository.write_record(
            TaskConnectionMapper.to_record(task_connection_entity))
예제 #3
0
    def test_write_record_new(self):
        """Test that we can create a new record."""
        entity = TaskConnectionEntity.get_mock_object()

        TaskConnectionRepository.write_record(
            TaskConnectionMapper.to_record(entity)
        )

        connections = TaskConnectionRepository.fetch_connections_for_pipeline(entity.pipeline_id)
        self.assertEquals(connections[0].id, entity.id)
예제 #4
0
    def write_task_connection(cls, task_connection_entity):
        """Writes a TaskConnectionEntity to the database.

        :param TaskConnectionEntity task_connection_entity:
        """
        task_connection_entity.validate()

        TaskConnectionRepository.write_record(
            TaskConnectionMapper.to_record(task_connection_entity)
        )
 def test_to_entity(self):
     """Test that a record can be converted into an entity."""
     self.assertEquals(
         TaskConnectionMapper.to_entity(self.url_to_log_connection).to_native(),
         {
             'id': self.url_to_log_connection.id,
             'from_task_id': self.url_to_log_connection.from_task_id,
             'pipeline_id': self.url_to_log_connection.pipeline_id,
             'to_task_id': self.url_to_log_connection.to_task_id,
         }
     )