Esempio n. 1
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))
Esempio n. 2
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)
Esempio n. 3
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)
        )
Esempio n. 4
0
 def test_fetch_connections_for_pipeline(self):
     """Test that only connections for a provided pipeline are returned."""
     self.assertItemsEqual(
         TaskConnectionRepository.fetch_connections_for_pipeline(self.pipeline1.id),
         [
             self.connection1,
         ],
     )
Esempio n. 5
0
    def test_write_record_update(self):
        """Test that we can write an updated record."""
        fake_uuid = uuid.uuid4()

        # Assert connection's from_task_id is not expected
        connection = TaskConnectionRepository.fetch_connections_for_pipeline(
            self.connection1.pipeline_id
        )[0]
        self.assertNotEquals(connection.from_task_id, fake_uuid)

        # Update connection's from_task_id
        connection.from_task_id = fake_uuid
        TaskConnectionRepository.write_record(connection)

        # Assert connection's from_task_id is as expected
        connection = TaskConnectionRepository.fetch_connections_for_pipeline(
            self.connection1.pipeline_id
        )[0]
        self.assertEquals(connection.from_task_id, fake_uuid)
Esempio n. 6
0
    def fetch_task_connections_for_pipeline(cls, pipeline_id):
        """Returns list of TaskConnectionEntities for a pipeline.

        :param str pipeline_id:
        :returns list: TaskConnectionEntities
        """
        return map(
            TaskConnectionMapper.to_entity,
            TaskConnectionRepository.fetch_connections_for_pipeline(pipeline_id),
        )
Esempio n. 7
0
    def fetch_task_connections_for_pipeline(cls, pipeline_id):
        """Returns list of TaskConnectionEntities for a pipeline.

        :param str pipeline_id:
        :returns list: TaskConnectionEntities
        """
        return map(
            TaskConnectionMapper.to_entity,
            TaskConnectionRepository.fetch_connections_for_pipeline(
                pipeline_id),
        )